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.
You can decide to allow special creative's features like the following per Advantage instance:
|Telephone||Allows ADvantage to initiate a phone call with going through the Dialer user interface (Dialer application)|
|SMS||Launch the SMS launcher application|
|InlineVideo||Allows ADvantage to play inline videos (only for
|Calendar||Launch the Calendar application|
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_STORAGEif you want an ad to be able to store a picture to device's local media gallery.
WRITE_CONTACTSif you want an ad to be able to write a contact information into device's contact list.
ACCESS_FINE_LOCATIONif 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:
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
To make use of protected features of the device, these permissions must be included in
The only required permission for ADvantage is
There are several furhter permission that have to be declared by
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)
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);