Android SDK Integration Version 3.1.2

Android SDK

  Version #: 3.1.2 Updated: 06-13-18

Quick download:




  • Android 4.2.2 (Jelly Bean, API 17) and higher. MRAID ads require API 19 and higher. Older Android versions will work, but are not officially supported.
  • Google Play Services will adhere to the user’s ad tracking preferences. For more information, please see Google's website regarding their Advertising ID.




Step 1: Download the SDK

Download the latest Android SDK here.


Step 2: Configure Your Project

    1. Unzip the downloaded SDK file, and copy aerserv-android-sdk/lib/aerserv-sdk.jar into your project's library folder.
    2. Add permissions and activity declarations to your AndroidManifest.xml.

View AndroidManifest.xml


Step 3: Initialize the SDK

You must initialize our SDK before loading any ads. We recommend that you invoke this initialization routine at least 10 seconds before you intend to show your first ad (a good location would be your main activity's onCreate() method). 

To initialize the SDK, invoke the following:

AerServSdk.init(MainActivity.this, MY_APP_ID);


How to obtain the app ID:

  1. Log on to the AerServ platform.
  2. Go to the 'Inventory' tab in the top navigation bar.
  3. Click the 'Edit' icon next to the app whose ID you wish to obtain.
  4. You will find the app ID at the very top of the page.


To set or update the General Data Protection Regulation (GDPR) user consent flag, call AerServSDK’s setGdprConsentFlag method. Pass true for user consent if GDPR user consent was granted and false if user consent was denied or if unknown. To have the GDPR user consent flag be set prior to an ad request, call the setGdprConsentFlag method before requesting an ad. The value passed into setGdprConsentFlag will persist as a private value within Android’s SharedPreferences. Thus, it is not necessary to reset the user consent value prior to each ad request; the value set is applicable for all subsequent requests until that value is reset.

Use the getGdprConsentFlag method in order to obtain the value of the GDPR user consent. If the value is not set, the method should return false.


An example would be:

//Replace true with the actual consent value of user consent  AerServSdk.setGdprConsentFlag((Activity) MY_ACTIVITY, (boolean) true);

AerServSdk.getGdprConsentFlag((Activity) MY_ACTIVITY);


Mediation Disclaimer:
Please be advised that although we are GDPR compliant, we currently have no way to send GDPR compliance as well as user consent to our mediated SDK partners. Compliance responsibility and request handling will solely depend on the SDK mediated partner.
Please contact your mediated partners to avoid any issues and/or complications.



Step 4: Configure Ads

Ad requests must first be configured with context and placement (PLC):

AerServConfig config = new AerServConfig(MY_CONTEXT, MY_PLC);


AerServConfig config = new AerServConfig(MainActivity.this, "1024876");

For additional configuration parameters, please see the Additional Settings section.


Step 5: Display Banner Ads

Create an AerServBanner object. One way of doing this is to define it in your Activity's layout file, e.g. activity_main.xml.

View sample activity_main.xml 


In your code, obtain a reference to AerServBanner, then configure and call show() on it.

View sample code 


You should pause your banner when your app is backgrounded, and play it when the app resumes. You can also kill a banner. The methods are:



Pausing a banner will prevent it from refreshing, and killing it will remove it from the view.


Step 6: Display Interstitial Ads

You can configure and show a test interstitial ad in your Activity, as follows:


AerServConfig config = new AerServConfig(MainActivity.this, "1000741");
AerServInterstitial interstitial = new AerServInterstitial(config);;



Optional Steps

Basic Event Listening

Preloading Interstitial Ads


Additional Settings

Virtual Currency

Additional Configurations

Complete List of Events

Proguard Configuration


Running AerServ Sample App

Sample App Instructions


Version History

View Android Version History


Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request