Skip to content
This repository has been archived by the owner on Aug 3, 2019. It is now read-only.

Privacy settings

Roman Kushnarenko edited this page Oct 16, 2014 · 1 revision

You can set the privacy settings of a single post (set who can / can't see the post).
Currently supported in:

  • Feed
  • Photo
  • Video

You have 2 options to define privacy.

  • Use basic settings
  • Use custom setting

Basic settings

Use one of the following predefined privacy settings:

  • EVERYONE
  • ALL_FRIENDS
  • FRIENDS_OF_FRIENDS
  • SELF

Build Privacy instance:

Privacy privacy = new Privacy.Builder()
	.setPrivacySettings(PrivacySettings.FRIENDS_OF_FRIENDS)
	.build();

Set to Photo, Video or Feed and publish:

Photo photo = new Photo.Builder()
	.setPrivacy(privacy)
	...
	.build();

// Publish photo
mSimpleFacebook.publish(photo, onPublishListener);

Custom settings

Use CUSTOM and select the users, friendlists to be in allowed or/and denied lists.

Build Privacy instance:

Privacy privacy = new Privacy.Builder()
	.setPrivacySettings(PrivacySettings.CUSTOM)
	.addAllowed("630243197") 
	.addAllowed(Collection<String>) 
	.addAllowed(PrivacySettings.ALL_FRIENDS)
	.addDenied("1456233371") 
	.addDenied(Collection<String>)
	.build();

You can combine and define users, friendlist to be in allowed and denied lists without limits. Just don't forget to set CUSTOM. See javadocs for additional details.

Clone this wiki locally