问题
I am using this code to post an image to the user wall
Bundle params = new Bundle();
params.putString("method", "photos.upload");
params.putString(
"caption",
"Download link");
JSONObject privacy = new JSONObject();
try {
privacy.put("value", "EVERYONE");
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
params.putString("privacy", privacy.toString());
byte[] imgData = takeScreenshot();
params.putByteArray("picture", imgData);
mAsyncRunner.request(albumId, params, "POST",
new SampleUploadListener(), null);
My problem is the post privacy is published not as "public" although I set it on my code to "everyone" privacy.put("value", "EVERYONE");
Is there any suggest to post it as "public"
Thanks
回答1:
I solved it flow these steps
Go to your list of apps (https://developers.facebook.com/apps?view=all_apps) Click on your app Click on 'App Details' Scroll down to 'App Center Listed Platforms' and click on the button on the right that says 'Configure App Center Permissions' Change the 'Default Activity Privacy' to public
回答2:
For anyone else looking for an answer I think the easiest way is to just set the default visibility/audience when requesting the permission with:
LoginManager.getInstance.setDefaultAudience(DefaultAudience.EVERYONE);
or
fb_login_button.setDefaultAudience(DefaultAudience.EVERYONE);
For the second one this is how the XML in your layout looks:
<com.facebook.widget.LoginButton
android:id="@+id/fb_login_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
See https://developers.facebook.com/docs/reference/android/current/class/DefaultAudience/
来源:https://stackoverflow.com/questions/23726597/publishing-a-post-with-privacy-public-using-facebook-sdk