Facebook响应给用户在发布墙时未授权该应用程序

时间:2013-08-29 09:48:51

标签: android facebook facebook-graph-api

我正在开发一个facebook登录注销示例,这对我来说很好。我的问题是当我向Facebook墙发布Feed时它会响应某种类型的错误。 我看到很多帖子但没有得到结果。谢谢......

protected void PublishFedd() {
    Session s = Session.getActiveSession();
    String testing="My testing app";
    Request request = Request.newStatusUpdateRequest(s,testing, new Request.Callback()
        {
            @Override
            public void onCompleted(Response response)
            {
                String checkTask=sharedpreference.getString("TASK_NAME", null);
                Log.i(TAG,"ExistingTask:"+checkTask);
                Boolean isNetworkConnected=inetDetector.isInternetConnected();
                if(isNetworkConnected)
                {
                    Log.i(TAG,"ResponseError:"+response.getError());

                if (response.getError() == null)
                {
                    SharedPreferences.Editor edit=sharedpreference.edit();
                    //edit.putString("TASK_NAME", testing);
                    edit.commit();
                    Toast.makeText(FacebookMainActivity.this, "Status updated successfully", Toast.LENGTH_SHORT).show();
                }
                else
                {

                }
                }
                else
                {
                    Toast.makeText(FacebookMainActivity.this, "Network Connection Failure", Toast.LENGTH_SHORT).show();
                }
            }
        });
    request.executeAsync();

}

错误日志是:

ResponseError:{HttpStatus: 403, errorCode: 200, errorType: OAuthException, errorMessage: (#200) The user hasn't authorized the application to perform this action}

1 个答案:

答案 0 :(得分:0)

只是要求权限。

String[] permissions = { "offline_access", "publish_stream", "user_photos", "publish_checkins","photo_upload" };
mFacebook.authorize(MainActivity.this, permissions,
            new LoginDialogListener());