문제

I'm currently using the Facebook SDK 3.0.1 for Android to post photos on Facebook. To upload my photos I'm invoking the method:

Request.newUploadPhotoRequest(session, screenShot, new Request.Callback() {});

The photo is posted on Facebook immediately, however only with the properties/permission "Only Me" instead of "Public" "Your Friends".

Do you know how to change this? Are there some permissions missing?

UPDATE - my solution

Session.openActiveSession(this, true, new Session.StatusCallback() {

@Override
public void call(Session session, SessionState state, Exception exception) {
    if ( exception != null )
    {
        //Log exception here
        return;
    }
    if ( state == SessionState.OPENED ) {
        List<String> permissions = new ArrayList<String>();
        permissions.add("photo_upload");
        session.requestNewReadPermissions(new Session.NewPermissionsRequest(MainActivity.this, permissions));
        Toast.makeText(MainActivity.this, R.string.facebook_login_succeeded_message, Toast.LENGTH_LONG).show();
    }
    else if ( state == SessionState.CLOSED ) {
    }
    else if ( state == SessionState.OPENED_TOKEN_UPDATED) {
    }
}
});
도움이 되었습니까?

해결책

When you request publish permissions (via the Session.NewPermissionsRequest), you can set the default audience to whatever you'd like (see here).

Beware, however, that the user can always limit the default audience later to whatever they choose, and your app cannot post above that audience. Also beware that most users do not want to post publicly, so defaulting to public can cause some users to deny your publish permission request.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top