I having problem in the scenario of getting user_birthday from the Facebook, I have tried many solution and i found that i cannot get extra info from the first authentication logIn so I've created another request for getting user birthday and i tried many accepted solution like this one but i still cannot get user email and the birthdate even when i tried to get age_range which is included in public_profile got nothing
and the facebook user is marked the birthdate as public i tried using sociauth library but with no success same problem
just i can get user birthday when im using my account which is the dev of the app
finally i used loginbutton
which is not my preferred scenario with permission
authbutton.setReadPermissions(Arrays.asList("public_profile","user_birthday"));
the wired thing is i can now get email without adding email permission but still get null with the birhtday and age_range
this is my loginbutton code
authbutton=(LoginButton) findViewById(R.id.authButton);
authbutton.setReadPermissions(Arrays.asList("public_profile","user_birthday"));
// session state call back event
authbutton.setSessionStatusCallback(new Session.StatusCallback() {
@Override
public void call(Session session, SessionState state, Exception exception) {
if (session.isOpened()) {
Log.i("tag","Access Token"+ session.getAccessToken());
Request.newMeRequest(session,
new Request.GraphUserCallback() {
@Override
public void onCompleted(GraphUser user,Response response) {
if (user != null) {
Log.i("tag","User ID "+ user.getId());
Log.i("tag","Email "+ user.asMap().get("email"));
lable.setText(user.getBirthday().toString());
}
}
}).executeAsync();
}
}
});
Thanks in advance
lable.setText(user.asMap().get("birthday").toString());
May be try this way?
The app id and the FB id you login to test should be of the same account. Else it will return null..
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.