Sending a photo with public privacy

Asked

Viewed 39 times

2

Through the code below, I can send a photo to the photos of the user who is logged in, and the photo is successfully sent.

But the photo goes with privacy Friends.

How do I send privately Audience?

Bundle params = new Bundle();
/* make the API call */
params.putByteArray("source", byteArray); 
params.putString("caption", "Titulo");
params.putBoolean("published", true);

new GraphRequest(AccessToken.getCurrentAccessToken(), "/me/photos", params, HttpMethod.POST, new GraphRequest.Callback() {
    public void onCompleted(GraphResponse response) {
        Log.i(TAG, response.toString());
    }
}).executeAsync();

1 answer

1


The privacy level (SDK Android) is set when the user authorizes your app with write permission and cannot be changed by your app.

When you request permission to write, you can set the desired audience. Example excerpt Rpssample accompanying the SDK:

LoginManager.getInstance()
.setDefaultAudience(DefaultAudience.FRIENDS)
.logInWithPublishPermissions(RpsFragment.this, Arrays.asList(ADDITIONAL_PERMISSIONS));

The audience level you seek is the DefaultAudience.EVERYONE. https://developers.facebook.com/docs/reference/android/current/class/DefaultAudience/

  • 1

    Perfect, exactly what I needed. Thank you!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.