Get friends of users using Facebook API - Android

I am trying to get all the friends of the user who has logged into my application.

I can not use this API [friends]:

https://developers.facebook.com/docs/graph-api/reference/v2.0/user/friends

Because this API only returns friends who used the application that created the request.

So, I found this API [friendlist]:

https://developers.facebook.com/docs/graph-api/reference/v2.0/friendlist

Following this answer , I got a list of friends.

But I get an empty list when I try to get a list of friends:

new Request( session, "/2692926356774/members", null, HttpMethod.GET, new Request.Callback() { public void onCompleted(Response response) { /* handle the result */ Log.e(LOG_TAG,"Members: " + response.toString()); } } ).executeAsync(); 

2692926356774 is my Acquaintances list id , I tried several other identifiers with the same result.

+47
android facebook facebook-friends
May 25 '14 at
source share
1 answer

In the v2.0 API, the caller /me/friends returns the personโ€™s friends who also use this application.

In addition, in version 2.0 you must request user_friends permission from each user. user_friends no longer enabled by default in all inputs. Each user must grant user_friends permission to appear in the /me/friends response. See the Facebook update guide for more details or view the summary below.

Permissions of /me/friendlists endpoint and user_friendlists not what you need. This endpoint does not return user friends - it allows you to access the lists that a person made to organize their friends. He does not return friends in each of these lists. This API and permission are useful to allow you to create a custom privacy selector, giving people the ability to post to Facebook.

If you want to access the list of friends who are not using the application, there are two options:

In other cases, applications can no longer get a complete list of userโ€™s friends (only those friends who specifically authorized your application using user_friends permission).

For applications that want people to invite friends to use the application, you can still use the Send Dialog on the Internet or the new Message Dialog in iOS and Android .

+79
May 29 '14 at 5:43
source share



All Articles