Android Facebook,无法获得publish_actions

时间:2014-08-06 09:00:08

标签: android facebook

我正在尝试使用publish_actions登录Facebook,

String applicationId = Utility.getMetadataApplicationId(getActivity());
    mCurrentSession = Session.getActiveSession();

    if (mCurrentSession == null || mCurrentSession.getState().isClosed()) {
        Session session = new Session.Builder(getActivity()).setApplicationId(applicationId).build();
        Session.setActiveSession(session);
        mCurrentSession = session;
    }

    if (!mCurrentSession.isOpened()) {
        Session.OpenRequest openRequest = null;
        openRequest = new Session.OpenRequest(getActivity());

        if (openRequest != null) {
            openRequest.setDefaultAudience(SessionDefaultAudience.FRIENDS);
            openRequest.setPermissions(Arrays.asList("publish_actions"));
            openRequest.setLoginBehavior(SessionLoginBehavior.SSO_WITH_FALLBACK);

            Session.setActiveSession(mCurrentSession);
            mCurrentSession.openForPublish(openRequest);
        }
    } else {
        Request.executeMeRequestAsync(mCurrentSession, new Request.GraphUserCallback() {
            @Override
            public void onCompleted(GraphUser user, Response response) {
            }
        });
    }

但这只给了我这些权限:

[public_profile, email, contact_email]

我还在mCurrentSession.requestNewPublishPermissions

上拨打onActivityResult
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

            Session.getActiveSession().onActivityResult(getActivity(), requestCode, resultCode, data);

            Log.e("TAG", mCurrentSession.getPermissions().toString());

            if (mCurrentSession.isOpened()) {
                Request.executeMeRequestAsync(mCurrentSession, new Request.GraphUserCallback() {
                    public void onCompleted(GraphUser user, Response response) {

                        List<String> permissions = mCurrentSession.getPermissions();
                        if (!isSubsetOf(PERMISSIONS, permissions)) {
                            Session.NewPermissionsRequest newPermissionsRequest = new Session.NewPermissionsRequest(getActivity(), Arrays.asList("publish_actions"));
                            mCurrentSession.requestNewPublishPermissions(newPermissionsRequest);
                            return;
                        }

                    }
                });

}

但我得到的只是:

[public_profile, email]

请帮助

1 个答案:

答案 0 :(得分:1)

Facebook登录允许人们快速登录应用程序并享受个性化的社交体验。

Facebook登录可让您的应用访问个人的公开个人资料,朋友列表和电子邮件地址。这三个权限不需要审核。相反,您应用的用户将选择是否要授予对此信息的访问权限。

为了让您的应用访问个人Facebook个人资料的其他元素(阅读权限)或代表他们向Facebook发布内容(写入权限),您需要提交以供审核

如果您的应用要求这三项基本权限,则无需通过“登录审核”:

<强> public_profile,

<强> user_friends

电子邮件

更多信息请访问以下链接。

1。Review Guidelines

2。Login Review