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

Configuration

slawekkrol edited this page Jun 22, 2015 · 5 revisions

Permissions and configuration

Add next lines in your Application or Activity class.

  • Define and select permissions you need:

     Permission[] permissions = new Permission[] {
     	Permission.USER_PHOTOS,
     	Permission.EMAIL,
     	Permission.PUBLISH_ACTION
     };
  • Build and define the configuration by putting app_id, namespace and permissions:

     SimpleFacebookConfiguration configuration = new SimpleFacebookConfiguration.Builder()
     	.setAppId("625994234086470")
     	.setNamespace("sromkuapp")
     	.setPermissions(permissions)
     	.build();
  • And, set this configuration:

     SimpleFacebook.setConfiguration(configuration);

    There is no need to set the configuration in any activity, it should be done just once.

Usage

1. onResume()

In each Activity where you want to use the library, just override the onResume() and set SimpleFacebook instance:

@Override
public void onResume() {
	super.onResume();
	mSimpleFacebook = SimpleFacebook.getInstance(this);
}

2. Override onActivityResult method and add this line:

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
	mSimpleFacebook.onActivityResult(requestCode, resultCode, data); 
	super.onActivityResult(requestCode, resultCode, data);
} 

You are ready to go with all features :)

Clone this wiki locally