0
在我的應用程序中,我的目的是獲得一些喜歡音樂,書籍,電視等朋友的興趣。這些信息是公開的。爲此,我認爲我不需要發送許可。 基於Facebook(窮人)文檔,主要是這個鏈接: Field Expansion爲了得到朋友興趣我只需要在擴展的朋友字段中傳遞朋友ID。 上做GraphExplorer一些測試,我看到它創建以下查詢來獲取電影形成了一些朋友:使用android facebook獲取好友興趣SDK
MY_ID?fields=friends.uid(FRIEND_ID).fields(movies)
我用這個和執行上Request.newMyFriendRequest執行該代碼以異步方式:
Session activeSession = Session.getActiveSession();
if(activeSession.getState().isOpened()){
Request request = Request.newMyFriendsRequest(activeSession,
new GraphUserListCallback(){
@Override
public void onCompleted(List<GraphUser> users, Response response){
GraphUser user = users.get(0);
JSONObject friendLikes = user.getInnerJSONObject();
try {
JSONArray data = friendLikes.getJSONObject("friends").getJSONArray("data");
Log.i("JSON", friendLikes.toString());
addInterests(data, 0);
} catch (JSONException e) {
e.printStackTrace();
}
}
});
Bundle bundle = new Bundle();
bundle.putString("fields", "friends.uid("+friendID+").fields(movies)");
request.setParameters(bundle);
request.executeAsync();
所有我執行此代碼的次數我從JSON收到以下錯誤: W/System.err(694):org.json.JSONException:對於朋友沒有任何價值。 如果這不是使用GraphAPI獲取朋友興趣的方式,那麼我需要做些什麼才能獲得這些值?
我只想從sdk獲得用戶興趣。我怎麼能得到這個,你能幫助我@戒掉。 –