(#100)对于这种类型的对象,尚未支持类似的动作 - android

时间:2013-10-15 21:09:34

标签: android facebook facebook-graph-api facebook-android-sdk

您好我试图在我的Android应用程序中使用像facebook的按钮。

我在这里查看了facebook提供的代码:

https://developers.facebook.com/docs/reference/opengraph/action-type/og.likes

在这里:

https://developers.facebook.com/docs/opengraph/guides/og.likes/#publishing

我添加了这种类型:

enter image description here

这是我的android代码:

class LikeTigoFacebook extends AsyncTask<String, Void, Void> {

        protected Void doInBackground(String... args) {

            Settings.addLoggingBehavior(LoggingBehavior.INCLUDE_ACCESS_TOKENS);

            Bundle params = new Bundle();
            params.putString("object",
                    "https://www.facebook.com/pages/Tigo/535949156477655");

            Request request = new Request(Session.getActiveSession(),
                    "me/og.likes", params, HttpMethod.POST);
            Response response = request.executeAndWait();

            Log.i("check", response.getError().getErrorMessage());
            Log.i("check2", response.toString());

            return null;
        }

        /**
         * After completing background task Dismiss the progress dialog
         * **/
        protected void onPostExecute(Void file_url) {

        }
    }

我收到此错误代码:

(#100) Like actions are not yet supported against objects of this type.

来自响应的完整字符串是:

{Response:  responseCode: 400, graphObject: null, error: {HttpStatus: 400, errorCode: 100, errorType: OAuthException, errorMessage: (#100) Like actions are not yet supported against objects of this type.}, isFromCache:false}

我的会话已打开,我在用户登录时添加了此权限:

private void onClickLogin() {

        Session currentSession = Session.getActiveSession();
        if (currentSession == null || currentSession.getState().isClosed()) {
            Session session = new Session.Builder(RegisterPage.this).build();
            Session.setActiveSession(session);
            currentSession = session;
        }

        if (currentSession.isOpened()) {
            // Do whatever u want. User has logged in

        } else if (!currentSession.isOpened()) {
            // Ask for username and password
            OpenRequest op = new Session.OpenRequest(
                    (Activity) RegisterPage.this);

            op.setLoginBehavior(SessionLoginBehavior.SUPPRESS_SSO);
            op.setCallback(null);

            List<String> permissions = new ArrayList<String>();
            permissions.add("email");
            permissions.add("publish_actions");
            op.setPermissions(permissions);

            Session session = new Session.Builder(RegisterPage.this).build();
            Session.setActiveSession(session);
            session.openForPublish(op);
        }
    }

我试着看看这里:

Built-in like action rejects the object type

它对我没有帮助,似乎是一个古老的答案。

感谢帮助

1 个答案:

答案 0 :(得分:0)

无法使用Open Graph“Like”操作发布Facebook页面的相似内容

请参阅documentation: og.likes操作可以引用任何打开的图形对象或URL,但Facebook页面或照片除外。

这里有一个问题解释: 'Like' a page using Facebook Graph API