我在进行一些搜索后用于获取列表的代码如下
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 : [用户朋友,基本信息]
获取最近拒绝的权限:[]
图形函数的输出是 -
响应{响应:responseCode:200,graphObject:{“summary”:{“total_count”:3},“data”:[]},错误:null}
那么有人可以指导我获取用户的好友列表吗?
提前致谢。
输出正确,您的朋友尚未授权您的应用程序。从 Graph API v2.0 开始,出于隐私原因,您只能获取授权您的应用程序的好友:https://developers.facebook.com/docs/graph-api/reference/v2.3/user/friends https://developers.facebook.com/docs/graph-api/reference/v2.3/user/friends
更多信息可以在此线程中找到:使用 Facebook Graph API 获取所有用户好友 - Android https://stackoverflow.com/questions/23850807/get-all-user-friends-using-facebook-graph-api-android
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)