Kishan Donga
Kishan Donga

Reputation: 3193

How to get Facebook friend email id in graph API?

I want to get the email id of the my friends who have installed same application in his/her device as required by Facebook graph API version 2.0 or above But I am only getting name and id of the my friends, How can i get the email id of the friend ?

Any help would be appreciated.

I tried this code

new GraphRequest(login_result.getAccessToken(),"/me/friends",null,HttpMethod.GET,
            new GraphRequest.Callback() {
                public void onCompleted(GraphResponse response) {

                    Intent intent = new Intent(MainActivity.this, FriendsList.class);
                      try {
                        JSONArray rawName = response.getJSONObject().getJSONArray("data");
                        intent.putExtra("jsonData", rawName.toString());
                        intent.putExtra("accessToken", login_result.getAccessToken());
                        startActivity(intent);
                      } catch (JSONException e) {
                        e.printStackTrace();
                    }
                }
            }
     ).executeAsync();

response Like :

{"data":[{"name":"Kishan Donga","id":"1104882236372503"}],"paging":{"cursors":{"before":"QVFIUjUzUWVQWndskfnbgtMXBCWHhSLTdCVW4xNmN3eUpTVlJaWFlyeG9leTJ1c0dIM2duZAU94bVdnTDh1c1RCOHBSaERUUXd1a1EwX2xOcU4zekl3aXBR","after":"QVFIUjUzUWVQWU42Q3pVZAHktMXBCWHhSLTdCVW4xNmN3eUpTVlJaWFlyeG9leTJ1c0dIM2duZAU94fbkdh1c1RCOHBSaERUUXd1a1EwX2xOcU4zekl3aXBR"}},"summary":{"total_count":3}}

Upvotes: 0

Views: 652

Answers (1)

Hemil Kumbhani
Hemil Kumbhani

Reputation: 349

Sorry friend you can't get the email address

Facebook's new API dosent allow you to take any information such as email,phone number etc

The only chances are 1. me/taggable_friends - Where you can get an Id for tagging your friends and profile picture ( your friends must also use the same app) 2. me/invitable friends - This one is for games only to invite people into your game

Here is the changelog

Upvotes: 1

Related Questions