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:
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.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
Android Ndk: Getting the Backtrace
How to Integrate Opencv into Qt Creator Android Project
How to Load External Webpage in Webview
What Kind of Font Files Do I Need for Modern Browsers, Android and iOS
Passing Data from Java Class to Web View HTML
Webview's HTML Button Click Detection in Activity
How to Change the Color of Header Bar and Address Bar in Newest Chrome Version on Lollipop
Android Webview Err_Unknown_Url_Scheme
Get Text from Web Page to String
How to Autoplay HTML5 Mp4 Video on Android
How to Make a Phone Call from HTML on Android
Html: Why Does Android Browser Show "Go" Instead of "Next" in Keyboard
Media Queries Not Behaving as Expected on Android
Letting Webview on Android Work with Prefers-Color-Scheme: Dark
How Much Support Is There for -Webkit-Overflow-Scrolling:Touch