1

I am using Facebook SDK 4.x, and i need to get friend list with name but i can't get it, i have also implemented this graph API

new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/me/friend",
null,
HttpMethod.GET,
new GraphRequest.Callback() {
    public void onCompleted(GraphResponse response) {
        /* handle the result */
    }
}
).executeAsync();

and this is my reponse

response {Response: responseCode: 200, graphObject: {"summary":{"total_count":3},"data":[]}, error: null}

I am not getting friend list with name, if you have any idea than plz give me. Thanks in Advance.

Ravi
  • 34,851
  • 21
  • 122
  • 183
Mohit Suthar
  • 8,725
  • 10
  • 37
  • 67
  • Facebook only returns the list of those friends who have authorized your app. So its necessary that for each friend your app is installed. – Skynet Dec 22 '15 at 12:15
  • Can i get friend name? – Mohit Suthar Dec 22 '15 at 12:16
  • 3
    @MohitSuthar have a look at this http://stackoverflow.com/questions/29491479/fetch-friends-list-from-facebook-sdk-4-0-1-in-android-with-graph-api-2-2 answer – Hardy Dec 22 '15 at 12:18

2 Answers2

2

I got solutions for using this

new GraphRequest(
            AccessToken.getCurrentAccessToken(),
            "/me/taggable_friends",
            null,
            HttpMethod.GET,
            new GraphRequest.Callback() {
                public void onCompleted(GraphResponse response) {
                    Log.e("getFriendsDat",""+ response);
                }
            }
    ).executeAsync();

You will get friend list with name and detail.
you have to add user_friends permission and need to submit your app for review.

Ravi
  • 34,851
  • 21
  • 122
  • 183
Mohit Suthar
  • 8,725
  • 10
  • 37
  • 67
0

First of all, it´s /me/friends, not /me/friend. That being said, you can only get access to friends who authorized your App too, with the user_friends permission. The response means that you have 3 friends, but none of them authorized your App with user_friends.

More information: Get ALL User Friends Using Facebook Graph API - Android

Community
  • 1
  • 1
andyrandy
  • 72,880
  • 8
  • 113
  • 130