从facebook sdk获取朋友列表4.0.1在Android中与图形api 2.2 [英] fetch friends list from facebook sdk 4.0.1 in android with graph api 2.2
问题描述
在进行一些搜索之后,用于获取列表的代码在
Code i used for fetching the list after doing some search is below
GraphRequestBatch batch = new GraphRequestBatch(
GraphRequest.newMyFriendsRequest(
accessToken,
new GraphRequest.GraphJSONArrayCallback() {
@Override
public void onCompleted(
JSONArray jsonArray,
GraphResponse response) {
// Application code for users friends
System.out.println("getFriendsData onCompleted : jsonArray " + jsonArray);
System.out.println("getFriendsData onCompleted : response " + response);
try {
JSONObject jsonObject = response.getJSONObject();
System.out.println("getFriendsData onCompleted : jsonObject " + jsonObject);
JSONObject summary = jsonObject.getJSONObject("summary");
System.out.println("getFriendsData onCompleted : summary total_count - " + summary.getString("total_count"));
} catch (Exception e) {
e.printStackTrace();
}
}
})
);
batch.addCallback(new GraphRequestBatch.Callback() {
@Override
public void onBatchCompleted(GraphRequestBatch graphRequests) {
// Application code for when the batch finishes
}
});
batch.executeAsync();
Bundle parameters = new Bundle();
parameters.putString("fields", "id,name,link,picture");
,我获得的权限是
accessToken:{AccessToken令牌:ACCESS_TOKEN_REMOVED权限:[user_friends,basic_info]}
getRecentlyGrantedPermissions:[user_friends,basic_info]
getRecentlyDeniedPermissions:[]
,图形函数的输出是 -
and the output of the graph function is -
response {Response:responseCode:200,graphObject:{summary:{total_count:3},data:[]},error:null}
所以任何人都可以指导我提交用户的朋友列表。
so can anyone please guide me to fetch the friend list of user .
提前Thanx。
推荐答案
输出正确无误,您的朋友都没有授权您的应用。自从v2.0版Graph API以来,只能获得授权您的应用的朋友,出于隐私的原因: https://developers.facebook.com/docs/graph-api/reference/v2.3/user/friends
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
在此主题中可以找到更多信息:使用Facebook Graph API - Android 获取所有用户的好友
More information can be found in this thread: Get ALL User Friends Using Facebook Graph API - Android
这篇关于从facebook sdk获取朋友列表4.0.1在Android中与图形api 2.2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!