errorMessage:(#200)用户未授权应用程序执行此操作},

时间:2015-02-08 11:32:00

标签: android android-facebook facebook-sdk-3.0

我正在开发一个Android应用程序,将状态发布到用户新闻feed.it与我的Facebook开发人员帐户一起工作正常。当我使用其他(fb)帐户时,它会显示上面给出的错误消息。我的代码在这里

currentSession = Session.getActiveSession();//this line is in onCreate Method

按下发布按钮后,方法打开=>

// Method For Link Sharing
public void updateView(final String msg) {
    // TODO Auto-generated method stub
    Session.openActiveSession(PostStatus.this, true,
            new Session.StatusCallback() {
                @Override
                public void call(Session session, SessionState state,
                        Exception exception) {

                    /**
                     * share the  link on facebook
                     */

                    if (session.isOpened()) {
                        Session.openActiveSessionWithPermissionPublish(
                                PostStatus.this, true,
                                new Session.StatusCallback() {
                                    @Override
                                    public void call(Session session,
                                            SessionState state,
                                            Exception exception) {
                                        // /**
                                        /**
                                         * share the video link on facebook
                                         */

                                        if (session.isOpened()) {

                                            Toast.makeText(
                                                    getApplicationContext(),
                                                    "Status uploading in progress please wait",
                                                    1000).show();

                                            Bundle parameters = new Bundle(
                                                    1);
                                            /*
                                             * parameters.putParcelable(
                                             * "picture", bitmap);
                                             */
                                            parameters.putString("message",
                                                    msg);

                                            parameters.putString(
                                                    "description",
                                                    "Via OneTouchKeys");
                                            Request request = new Request(
                                                    Session.getActiveSession(),
                                                    "me/feed", parameters,
                                                    HttpMethod.POST,
                                                    new Request.Callback() {
                                                        @Override
                                                        public void onCompleted(
                                                                Response response) {
                                                            showPublishResult(
                                                                    "!!!!",
                                                                    response.getGraphObject(),
                                                                    response.getError());
                                                        }
                                                    });

                                            request.executeAsync();

                                        }
                                    }
                                }
                                /**
                                 * permission to publish on facebook
                                 */
                                , Arrays.asList(MY_PERMISSIONS_PUBLISH));

                    }

                }
            }
    /**
     * permission to publish on facebook
     */
    );

}

    // Permissions for access facebook sharing
public static final String[] MY_PERMISSIONS_PUBLISH = {"publish_actions" };
public static final String[] MY_PERMISSIONS_READ = { "basic_info" };

我使用发布密钥从eclipse导出应用程序并将其保存到我的开发者帐户中。我不知道我是不是以正确的方式获得了许可,或者错过了为每个人使用它的一些步骤。虽然它只适用于我的开发者帐户。

0 个答案:

没有答案