簡體   English   中英

如何通過新的圖形API v2.5獲取帶有電子郵件的Facebook朋友列表?

[英]how to get facebook friend list with emails through new graph api, v2.5?

我正在嘗試使用下面的代碼獲取朋友列表

GraphRequest request = GraphRequest.newMyFriendsRequest(
                token,
                new GraphRequest.GraphJSONArrayCallback() {
                    @Override
                    public void onCompleted(JSONArray array, GraphResponse response) {
                        // Insert your code here
                    }
                });
        request.executeAsync();
    }

執行代碼后返回的響應是

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

登錄時間允許access friendspublic profile 我如何獲取朋友列表和他們的公共電子郵件/ Facebook電子郵件?

您只會收到也在使用您的應用程序的朋友,請參閱

/me/friends返回也在使用您的應用程序的用戶朋友。在v2.0中,friends API端點返回也在使用您的應用程序的個人朋友的列表。 在v1.0中,響應包括一個人的所有朋友。

而且, 沒有 ,如果您要詢問,也沒有解決方法。

您可以使用graph-api調用獲取好友列表

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

但是限制是

  1. api需要具有user_friends權限的訪問令牌
  2. 只返回那些也被授予對您使用的同一個應用程序訪問權限的朋友

https://developers.facebook.com/docs/graph-api/reference/v2.5/user/friends

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM