Skip to content

Permissions

Custom and system permissions are basic building blocks of the ADvantage permission mechanism. If a custom permission is denied on an ADvantage instance , the proper action or feature will not be available to it's creative. If a custom permission is granted on an ADvantage instance , the system permission will be checked and if it is granted, the action can be performed, otherwise the action is not available to the creative.

Custom Permissions

You can decide to allow special creative's features like the following per Advantage instance:

Permission Description
Telephone Allows ADvantage to initiate a phone call with going through the Dialer user interface (Dialer application)
Store Picture WRITE_EXTERNAL_STORAGE Allows an application to write to external storage.
SMS Launch the SMS launcher application
Sensors
  • SENSOR_COMPASS
  • SENSOR_ACCELEROMETER
  • SENSOR_GYROSCOPE
  • SENSOR_LIGHT
  • SENSOR_BAROMETER
  • SENSOR_STEP_DETECTOR
  • SENSOR_PROXIMITY
Rotation SCREEN_PORTRAIT | SCREEN_LANDSCAPE
InlineVideo Allows ADvantage to play inline videos (only for HONEYCOMB or newer)
Contacts WRITE_CONTACTS Allows an application to write into the user's contacts data.
Calendar Launch the Calendar application

System Permissions

For ADvantage there is no need to set System permissions like SEND_SMS, CALL_PHONE or READ_CALENDAR.

The above mentioned functions SMS, Telephone and Calendar are just calling intents that handle that functionalities.

The only permissions that need to be set are:

  • WRITE_EXTERNAL_STORAGE if you want an ad to be able to store a picture to device's local media gallery.
  • WRITE_CONTACTS if you want an ad to be able to write a contact information into device's contact list.
  • ACCESS_COARSE_LOCATION and ACCESS_FINE_LOCATION if you want an ad to be able to use the device's geo-location information.

Custom Permission Example

To get a better understanding on how these two systems interact, view the following code example:

banner.setPermittedAndSupportedFeature(PermittedAndSupportedFeature.CONTACT, false);

If the custom permission PermittedAndSupportedFeature.CONTACT is explicitly set to false, the creative will not be able to add any contact to the devices phone book, although in AndroidManifest.xml there might be WRITE_CONTACTS permissions set.

If the custom permission PermittedAndSupportedFeature.CONTACT is explicitly set to true (or implicitly by default setting), the creative will be able to add contacts to the devices phone book, but only if the necessary permissions (WRITE_CONTACTS in this case), are permitted by AndroidManifest.xml.

System Permissions

To make use of protected features of the device, these permissions must be included in AndroidManifest.xml.

Required permission

The only required permission for ADvantage is INTERNET.

<uses-permission android:name="android.permission.INTERNET"/>

Optional permissions

There are several furhter permission that have to be declared by AndroidManifest.xml:

ACCESS_FINE_LOCATION and ACCESS_COARSE_LOCATION permissions needed in order to enable GPS access for the creatives.

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION " />

WRITE_EXTERNAL_STORAGE permission needed in order to enable the creative to store a picture to local phone storage.

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

WRITE_CONTACTS permission needed in order to enable the creative to store contact information to the phone.

<uses-permission android:name="android.permission.WRITE_CONTACTS" />

READ_PHONE_STATE permission needed for the creative to retreive information from the phone, that can be optionally send to the adserver as an additional parameter. For more information read Predefined AdServerParameter)

<uses-permission android:name="android.permission.READ_PHONE_STATE"/>

Revoke permissions

You can change custom permissions.

Default permission values

All custom permissions are granted TRUE by default.

For instance, an application that needs to prevent sending SMS messages would specify:

//Disable Custom SMS Permission.
banner.setPermittedAndSupportedFeature(PermittedAndSupportedFeature.SMS, false);