Android Facebook get email address of logged in through access token
-
27-10-2019 - |
Question
In my app, I have allowed users to signup through Facebook. When user logged in, I get access token. Now I want to get email address of the user. How to get that?
Solution
First of all add permission
public static final String[] PERMISSIONS = new String[] {"email"};
String response=authenticatedFacebook.request("me");
JSONObject obj = Util.parseJson(response);
useremail=obj.getString("email");
where authenticatedFacebook is Facebook object.
Util will available along with Facebook SDK.
Ensure that you gave Email permission.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow