Android : cannot get user_birthday from facebook

on Thursday, September 18, 2014


i having problem in the scenario of getting user_birthday from the facebook i have been tried many solution and i found that i cannot extra info from the first authentication log in 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 i m 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


0 comments:

Post a Comment