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

Request new permissions

Roman Kushnarenko edited this page Jun 20, 2015 · 2 revisions

One of the main ideas of this library is to make life easier by simplifing usage of permissions. You can find that all permissions are predefined and you don't need to care for the order and code flow of READ and PUBLISH permissions.

You can request new permissions in runtime. The popup with new set of permissions will be shown to user.

Initialize callback listener:

OnNewPermissionsListener onNewPermissionsListener = new OnNewPermissionsListener() {

	@Override
	public void onSuccess(String accessToken, List<Permission> acceptedPermissions, List<Permission> declinedPermissions) {
		// updated access token 
	}

	@Override
	public void onCancel() {
		// user canceled the dialog
	}

	@Override
	public void onFail(String reason) {
		// failed
	}

	@Override
	public void onException(Throwable throwable) {
		// exception from facebook
	}
	
}

Set array of new permissions you want:

Permission[] permissions = new Permission[] { 
	Permission.USER_VIDEOS,
	Permission.FRIENDS_EVENTS,
	Permission.PUBLISH_STREAM
};

Ask for new permissions:

mSimpleFacebook.requestNewPermissions(permissions, onNewPermissionsListener);

If permissions array include both READ and PUBLISH permissions, then it will behave based on the AllAtOnce flag that you defined in configuration. If you decided to request for all permissions at once, then this method will behave the same.

Clone this wiki locally