2015-12-22 49 views
1

我使用Facebook SDK 4.x,我需要得到具有名好友列表,但我不能得到它, 我也实现了这个graph API获取Facebook的好友列表与名称

new GraphRequest(
AccessToken.getCurrentAccessToken(), 
"/me/friend", 
null, 
HttpMethod.GET, 
new GraphRequest.Callback() { 
    public void onCompleted(GraphResponse response) { 
     /* handle the result */ 
    } 
} 
).executeAsync(); 

,这是我reponse

response {Response: responseCode: 200, graphObject: {"summary":{"total_count":3},"data":[]}, error: null} 

我没有得到名称的朋友列表,如果你有任何想法比PLZ给我。 在此先感谢。

+0

的Facebook只返回谁已授权您的应用程序的朋友列表。所以它必须为每个朋友安装您的应用程序。 – Skynet

+0

我可以得到朋友的名字吗? –

+3

@MohitSuthar看看这个http://stackoverflow.com/questions/29491479/fetch-friends-list-from-facebook-sdk-4-0-1-in-android-with-graph-api-2- 2答案 – Hardy

回答

2

我的解决方案使用此

new GraphRequest(
      AccessToken.getCurrentAccessToken(), 
      "/me/taggable_friends", 
      null, 
      HttpMethod.GET, 
      new GraphRequest.Callback() { 
       public void onCompleted(GraphResponse response) { 
        Log.e("getFriendsDat",""+ response); 
       } 
      } 
    ).executeAsync(); 

你将会得到一个名字和细节的好友列表。
你必须添加user_friends许可,并需要提交您的应用程序进行审核。

0

首先,it's /me/friends,不/me/friend。话虽这么说,你只能得到访问授权谁你的App也与user_friends许可朋友。响应意味着你有3个朋友,但他们没有授权您的应用user_friends

的更多信息:Get ALL User Friends Using Facebook Graph API - Android

+0

如果任何朋友授权我的应用程序比我获得他的名字?您可以在我的回答中阅读 –

+0

,朋友必须使用user_friends授权您的应用 – luschn