I am having trouble getting email from Facebook in my app. I have googled a lot and came across many answers but nothing is working in my case. I followed the same method described here, but the value returning is null. Below given is my code. And also I have added User & Friend permissions as email in the facebook app. It would be of great help if someone could point out the mistake I might be doing.
private void makeMeRequest(final Session session) {
Request request = Request.newMeRequest(session,
new Request.GraphUserCallback() {
@Override
public void onCompleted(GraphUser user, Response response) {
if (session == Session.getActiveSession()) {
if (user != null) {
profilePictureView.setProfileId(user.getId());
facebook_id = String.valueOf(user.getId());
fullName.setText(user.getName());
if (user.asMap().get("email") != null)
email.setText(user.asMap().get("email")
.toString());
}
}
if (response.getError() != null) {
}
}
});
Bundle params = request.getParameters();
params.putString("fields", "email,name");
request.setParameters(params);
request.executeAsync();
}