Facebook Graph API v2.4 likeview

时间:2017-06-21 22:03:48

标签: android facebook facebook-graph-api facebook-graph-api-v2.4 facebook-graph-api-v2.3

我在Android应用程序中遇到了Facebook likeview按钮的问题。它现在正在使用Graph API Level v2.3,但它将在7月8日弃用,所以我必须更新它,但我不知道该怎么做,添加“like”参数。

我检查了更改日志;

  

从v2.3到v2.4的变化

     

陈述性字段

     

尝试提高移动网络,节点和边缘的性能   v2.4要求您明确请求所需的字段   你的GET请求。例如,GET /v2.4/me/feed不再包含   喜欢和评论默认,但GET   /v2.4/me/feed?fields=comments,likes将返回数据。更多   详细信息请参阅有关如何请求特定字段的文档。

在我的代码中像这样设置;

likeview.setVisibility(View.VISIBLE);
    likeview.setObjectIdAndType(selectedEvent.xxxxxxweburl, LikeView.ObjectType.DEFAULT);
    likeview.setLikeViewStyle(LikeView.Style.BUTTON);
    likeview.setAuxiliaryViewPosition(LikeView.AuxiliaryViewPosition.INLINE);
    likeview.setHorizontalAlignment(LikeView.HorizontalAlignment.LEFT);

我的Helper类中的onActivityResult;

public void onActivityResult(int requestCode, int resultCode, Intent data) {
        callbackManager.onActivityResult(requestCode, resultCode, data);
    }

我的ActivityManager类中的onActivityResult;

@Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

        facebookHelper.onActivityResult(requestCode, resultCode, data);

        // Check if result comes from the correct activity
        if (requestCode == REQUEST_CODE) {
            AuthenticationResponse response = AuthenticationClient.getResponse(resultCode, data);
            switch (response.getType()) {
                // Response was successful and contains auth token
                case TOKEN:
                    onAuthenticationComplete(response);
                    break;

                // Auth flow returned an error
                case ERROR:
                    logStatus("Auth error: " + response.getError());
                    break;

                // Most likely auth flow was cancelled
                default:
                    logStatus("Auth result: " + response.getType());
            }
        }
    }

0 个答案:

没有答案