您好,我尝试从登录的用户那里获取用户名和用户 ID。
我尝试在我的 onActivityResuly 中使用此代码,但它没有被触发。
感谢您的帮助:)
final Session session = Session.getActiveSession();
Request request = Request.newMeRequest(session, new Request.GraphUserCallback() {
@Override
public void onCompleted(GraphUser user, Response response) {
// TODO Auto-generated method stub
if (session == Session.getActiveSession()) {
if (user != null) {
facebook_id = user.getId();//user id
facebook_name= user.getName();
Log.i("facebook_id", facebook_id);
Log.i("facebook_name", facebook_name);
new GetProfilePicture().execute();
}
}
}
});
Request.executeBatchAsync(request);
super.onActivityResult(requestCode, resultCode, data2);