Our documentation is changing, please click here to enjoy it!

Skip to end of metadata
Go to start of metadata

If you need to provide programmatically partner Id and private Key to the SDK, you can implement our com.ad4screen.sdk.AccIdsContentProvider interface in your class and provide your credentials. Both getPartnerId() and getPrivateKey() must return values as fast as possible, so never do any long running operations in the methods.

Usage

Implement the AccIdsContentProvider interface:

MyAccIdsContentProvider.java

Don't forget to replace the strings shown below by your own Partner Id and Private Key

Please note that if your provider returns null values, SDK will not start and will retry to get a partner id/private key by calling your provider every 10 sec

Note that if your code is obfuscated, you have to add a proguard rule for this class : -keep class your.package.MyAccIdsContentProvider { *; }

Add the provider tag to your AndroidManifest.xml file: 

AndroidManifest.xml

Remove strings acc_partner_id and acc_private_key from your strings.xml file.

Warning

Please don't forget to set android:multiprocess to false, because we need to create only one instance of AccIdsContentProvider, otherwise it will be created in two processes : in the app and the SDK. (Reminder that the SDK run in another process)

Update credentials

Two instances of your class implementing AccIdsContentProvider are created at the first access to the SDK by calling A4S.get() method. At the same time the SDK call getPartnerId() and getPrivateKey() to obtain credentials. These credentials will be used by the SDK until the application will not be restarted (killed and relaunched).

To apply new values at runtime, for example, if you need to change a country with another partner ID and private key without restarting the app, you need to use A4S.get(context).reinitPartnerId(). The method will call getPartnerId() and getPrivateKey() of your class to obtain new credentials, and then reinitialize the SDK.

 

 

 

  • No labels