使用api 2.5无法获得facebook的用户时间表

时间:2016-01-15 19:49:49

标签: android facebook facebook-graph-api

我正试图在我的Android应用中获取Facebook的用户时间线。 这是我的代码:

mLoginButton.setReadPermissions(Arrays.asList("user_about_me", "user_friends", "user_likes",
            "user_photos", "user_relationships", "user_posts",
            "user_status"));

    // If using in a fragment
    mLoginButton.setFragment(this);
    // Other app specific specialization

    // Callback registration
    mLoginButton.registerCallback(mCallbackManager, new FacebookCallback<LoginResult>() {

        @Override
        public void onSuccess(LoginResult loginResult) {
            mAccessToken = loginResult.getAccessToken();

            for (String permission : loginResult.getRecentlyGrantedPermissions()) {
                Log.d(LOG_TAG, "Granted Permission:" + permission);
            }

            getUserFeed();
        }

        @Override
        public void onCancel() {
            // App code
        }

        @Override
        public void onError(FacebookException exception) {
            // App code
        }
    });

登录后,我启动了这个:

private void getUserFeed() {

    Bundle params = new Bundle();
    params.putInt("limit", 25);
    params.putString("fields", "id,name,link,full_picture,message,story,picture,type,place,from,to");
    params.putBoolean("summary", true);

    /* make the API call */
    new GraphRequest(
            AccessToken.getCurrentAccessToken(),
            "/me/home",
            params,
            HttpMethod.GET,
            new GraphRequest.Callback() {
                public void onCompleted(GraphResponse response) {
                    try {
                        final JSONArray data = response.getJSONObject().getJSONArray("data");
                        //currentJson = response.getJSONObject();
                    } catch (JSONException e) {
                        Log.e("Error: ", e.toString());
                    }
                }
            }
    ).executeAsync();

}

我有来自Facebook的回复代码:

Requires extended permission: read_stream

我知道此权限已被删除,我正在使用最新的API 2.5。

你知道我们现在是否可以继续获得用户的时间表,如果我用“/ me / feed”替换“/ me / home”就可以了,但我只收到我的帖子,而不是我的整个时间表。< / p>

谢谢:)

1 个答案:

答案 0 :(得分:0)

  

您知道我们现在是否可以继续获取用户的时间表,

不,你不能。

  

如果我更换&#34; / me / home&#34; by&#34; / me / feed&#34;没关系,但我只收到我的帖子,而不是我的整个时间表。

/me/home与权限一起被弃用。

/me/feed是你现在能得到的,就是这样。

此处列出了您可以看到哪些帖子:https://developers.facebook.com/docs/graph-api/reference/v2.5/user/feed#readperms

相关问题