TootsieRockNRoll
TootsieRockNRoll

Reputation: 3288

Android Facebook, can't get publish_actions

I am trying to login to Facebook with publish_actions,

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) {
            }
        });
    }

but this only gives me these permissions:

[public_profile, email, contact_email]

so further more I call mCurrentSession.requestNewPublishPermissions on 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;
                        }

                    }
                });

}

but then all I get is :

[public_profile, email]

please help

Upvotes: 0

Views: 495

Answers (1)

Ando Masahashi
Ando Masahashi

Reputation: 3122

Facebook Login allows people to sign in quickly to an app and enjoy a personalized, social experience.

Facebook Login provides your app access to a person's public profile, friend list, and email address. These three permissions do not require review. Instead, your app's users will choose whether they want to grant access to this information.

In order for your app to access additional elements of a person's Facebook profile (read permissions) or to publish content to Facebook on their behalf (write permissions), you will need to submit for review

You do not need to go through Login Review if your app requests these three basic permissions:

public_profile,

user_friends,

email

For More Information Visit Following link.

1.Review Guidelines

2.Login Review

Upvotes: 1

Related Questions