Get All User Friends Using Facebook Graph API - Android

Get ALL User Friends Using Facebook Graph API - Android

In v2.0 of the Graph API, calling /me/friends returns the person's friends who also use the app.

In addition, in v2.0, you must request the user_friends permission from each user. user_friends is no longer included by default in every login. Each user must grant the user_friends permission in order to appear in the response to /me/friends. See the Facebook upgrade guide for more detailed information, or review the summary below.

The /me/friendlists endpoint and user_friendlists permission are not what you're after. This endpoint does not return the users friends - its lets you access the lists a person has made to organize their friends. It does not return the friends in each of these lists. This API and permission is useful to allow you to render a custom privacy selector when giving people the opportunity to publish back to Facebook.

If you want to access a list of non-app-using friends, there are two options:

  1. If you want to let your people tag their friends in stories that they publish to Facebook using your App, you can use the /me/taggable_friends API. Use of this endpoint requires review by Facebook and should only be used for the case where you're rendering a list of friends in order to let the user tag them in a post.

  2. If your App is a Game AND your Game supports Facebook Canvas, you can use the /me/invitable_friends endpoint in order to render a custom invite dialog, then pass the tokens returned by this API to the standard Requests Dialog.

In other cases, apps are no longer able to retrieve the full list of a user's friends (only those friends who have specifically authorized your app using the user_friends permission).

For apps wanting allow people to invite friends to use an app, you can still use the Send Dialog on Web or the new Message Dialog on iOS and Android.

How to get list of friends in Facebook Graph API ver 2.5?

There is no way to get a list of all friends in the new api. Facebook has restricted this. Now it only shows list of friends who have already visited your app. So you can show like

"These are your friends who have used this app" but can't show a list of all friends. This is how you get friends list (who have visted app already)

 $response = $fb->get('/me?fields=id,name,email,friends', $acces_token);
$user = $response->getGraphObject();
foreach($user['friends'] as $friend){
//Do Stuff here
}

fetch friends list from facebook sdk 4.0.1 in android with graph api 2.2

The output is correct, none of your friends authorized your App yet. Since v2.0 of the Graph API you can only get the friends who authorized your App, for privacy reasons: https://developers.facebook.com/docs/graph-api/reference/v2.3/user/friends

More information can be found in this thread: Get ALL User Friends Using Facebook Graph API - Android

Get Facebook Friend List with Name

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.

Facebook graph api user_friends only return one friend

You can´t get the list of all users who have installed your App, you can only get a list of your friends who authorized your App with the user_friends permission too. It seems that only one friend of yours authorized your App.

Android Facebook API, How to get friend list?Retuning Data is null, Even though API version is v2.5

Since v2.0 of the Graph API you can only get the friends who authorized your App, for privacy reasons:https://developers.facebook.com/docs/graph-api/reference/v2.3/user/friends

for more information check this



Related Topics



Leave a reply



Submit