I have a Facebook login option in my Android app and I am trying to get the user's email unsuccessfully. After the user is logged in, and added to the Parse.com User table (with a valid access token), I request the Facebook user info, but only get it's id and name (even though the email is set as one of the permissions).
Here's my code (inside OnClickListener of my button):
ParseFacebookUtils.logInWithReadPermissionsInBackground(
getActivity(), Arrays.asList("email", "user_friends"), new LogInCallback() {
@Override
public void done(ParseUser user, ParseException err) {
//err is null
if (user == null) {
Log.d(TAG, "Uh oh. The user cancelled the Facebook login.");
} else {
GraphRequest.newMeRequest(
AccessToken.getCurrentAccessToken(),
new GraphRequest.GraphJSONObjectCallback() {
@Override
public void onCompleted(JSONObject user, GraphResponse response) {
Log.d(TAG, "user = " + user.toString());
//prints -> user = {"name":"my_fb_name","id":"my_fb_id"}
}
}
).executeAsync();
}
});