Getting Started with Android SDK

Important Highlights

  1. If you are using a Proguard in your project and do not rely on the Unity framework, please review the Proguard Configuration section.
  2. If you would like more technical information for supporting Android Pie, please see the Android Pie support section.

Download the Smaato Android SDK

To download the latest version of our Android SDK, you can either log into SPX and download from the integration options or download it from our Smaato website.

Add the Smaato SDK to Your Project

  1. Download and unzip the Smaato SDK.
    • You will also find the SDK AAR file.
  2. Copy it into the libs/-directory of your app module, creating it if necessary.
  3. Then add the following to the repositories section in your module’s build.gradle:
repositories {
    flatDir {
        dirs 'libs'

Add the following dependency in your module’s build.gradle:

dependencies {
    implementation (name:'SOMAAndroid-9.1.8-release', ext:'aar')

Do not forget to sync your project with Gradle files.

  1. Go to Tools > Android > Sync Project with Gradle Files.
  2. Please check our Smaato Demo App for more information.

Android Archive (AAR) File Format

Starting with version 7, the SOMA SDK is distributed as an Android Archive (AAR) instead of a Java Archive (JAR). This requires some changes to be made with integrating the SDK into the app:

  • Add the AAR file into the libs/-directory, just like the JAR file previously.
  • Add the following to the repositories section in your module’s build.gradle:
repositories {
    flatDir {
        dirs 'libs'
  • Add the following dependency in your module’s build.gradle:
dependencies {
    implementation (name:'SOMAAndroid-9.1.8-release', ext:'aar')
  • If you do not depend on any other JAR files present in your, libs/-directory you may remove the following line from your dependencies:
compile fileTree(dir: 'libs', include: ['*.jar'])
  • To sync your project with Gradle files, go to Tools > Android > Sync Project with Gradle Files.

Android Manifest xml

Permissions for configuring Android Manifest xml

For the SDK to run correctly, some permissions need to be granted:

  • INTERNET (mandatory)
  • ACCESS_NETWORK_STATE (strongly recommended)
  • ACCESS_COARSE_LOCATION (recommended)

Open Your AndroidManifest.xml and Add the Following Lines:

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

Targeting Apps Android 5.0+

If your app targets Android 5.0 or higher and if you are using the setLocationUpdateEnabled(true) method on any AdView instance we recommend that you add the following to the AndroidManifest.xml file for a more accurate location in addition to the permissions needed. More info about this can be found on the Android developer website

<uses-feature android:name="android.hardware.location.gps" />
<uses-feature android:name="" />

Google Play Services

If you are using the Google Play Services SDK, please add the following metadata to your AndroidManifest.xml:

<meta-data android:name="" android:value="@integer/google_play_services_version"/>

SOMA Activity Declaration

From version 4.5.0 onwards, we introduced the enhanced SDK browser that requires its activity to be declared:

<activity android:name="com.smaato.soma.ExpandedBannerActivity" android:configChanges="keyboardHidden|orientation|screenSize" />

With the introduction of the interstitial ad format, this activity also needs to be declared in your manifest.xml. Please add the following lines to your manifest configuration:

<activity android:name="com.smaato.soma.interstitial.InterstitialActivity" android:configChanges="keyboardHidden|orientation|screenSize" />

From version 5.1.2 onward, we introduced the enhanced SDK functionality that allows you to display ads in either portrait mode or landscape mode.

Removed Exception Declarations From Callback Methods

The methods AdListenerInterface.onReceiveAd() and BannerStateListener.onWillCloseLandingPage() no longer declare to throw any exceptions. If you implement these methods, you may need to remove those declarations.

Rewarded Video Auto-Close

Rewarded videos no longer support auto-closing. If you wish to have auto-closing video ads, please use the regular video ads provided by the SOMA SDK.

MoPub Adapter Naming

For consistency, the MoPub native adapter was renamed from SmaatoMopubNativeCustomEvent to SomaMopubNativeCustomEvent. The parameter used to pass the ad space ID has been renamed to adSpaceId (with a capital S). If you wish to use the updated adapters, you may need to match your MoPub configuration to these names.

General Data Protection Regulation (GDPR)

As a publisher, you should integrate a Consent Management Platform (CMP) and request for vendor and purpose consents as outlined in IAB Europe’s Mobile In-App CMP API v1.0: Transparency & Consent Framework. You can find a reference implementation of a web-based CMP and the corresponding native wrappers here:

If you are embedding your own custom CMP, the collected end-user consent information needs to be stored in SharedPreferences using the following keys:

Key Type Description
IABConsent_CMPPresent boolean Set to YES if a CMP that follows the IAB specification is present in the application.
IABConsent_SubjectToGDPR String “1” = Subject to GDPR
“0” = Not subject to GDPR
“-1” = Unknown (default before initialization)
IABConsent_ConsentString String Base64-encoded consent string as defined in by the IAB: Consent string and vendor list format v1.1
IABConsent_ParsedPurposeConsents String String of “0”s and “1”s, where the character at position N indicates the consent status to purposeID N as defined in the Global Vendor List
IABConsent_ParsedVendorConsents String String of “0”s and “1”s, where the character at position N indicates the consent status to vendorID N as defined in the Global Vendor List

Important Details About CCPA

The California Consumer Privacy Act (CCPA) was created to provide California consumers with greater transparency and control over their personal information. In many ways, the CCPA is a first of its kind regulation in the United States that seeks to create broad privacy and data protection rules that apply to all industries doing business in the jurisdiction of California, rather than focusing on a single sector or specific data collection and use practices.

For more information about the CCPA regulation, please check out the Smaato FAQ. You can also review the IAB’s U.S. Privacy String documentation.

For Publishers with California-Based Users

As a publisher, you need to make sure to request consent from California-based users (to give or refuse consent / to opt-out or opt-in ) about private data transfer. This answer should be saved in SharedPreferences with key “IABUSPrivacy_String” in the US Privacy String format (CCPA Opt-Out Storage Format).

The Smaato NextGen SDK reads this value in the key “IABUSPrivacy_String” if it exists and uses this as an optional parameter for all ad requests.

Sample of US Privacy String Saving in SharedPreferences

As per the guidelines defined by IAB for CCPA, publishers are required to set CCPA value for key IABUSPrivacy_String inside SharedPreferences.

SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext());
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString("IABUSPrivacy_String", "1YNN");

Children’s Online Privacy Protection Act (COPPA)

“COPPA” stands for The Children’s Online Privacy Protection Rule ( It imposes certain requirements on Publishers (operators of websites or online services) with apps/sites directed to children under 13 years of age, and on operators of other websites or online services (i.e., Smaato) that have Actual Knowledge (defined below) that they are collecting personal information online from a child under 13 years of age.

Enabling COPPA

You are able to activate and deactivate COPPA by using the following example:

mBanner.getUserSettings().setCOPPA(value); // true to enable, false otherwise.

When should the COPPA Flag be set to COPPA=1?

If the Publisher doesn’t have an age, or even if the Publisher has an age gate, Smaato may need to flag the Publisher’s application as COPPA=1:

  1. A Publisher notifies Smaato Sales (or emails Smaato Legal) that they have an application directed towards children OR
  2. If Smaato notices that a Publisher’s application is very obviously directed to children under 13 (e.g., the application with “for Kids” in the name, or if it has animations, reviews, “common sense media scores,” that indicate so).

If the Publisher has an age gate, such that the age of the end-user is known, then:

  • Age gate says end-user is <13, then Publisher must send the COPPA=1 flag;
  • Age gate says end-user is ≥13, then Publisher should send the COPPA=0 flag.

Proguard Configuration

If you’re using Proguard in your project, please add the following lines to your Proguard config file as per your requirements:

-assumenosideeffects class android.util.Log {
    public static *** d(...);
    public static *** v(...);
    public static *** i(...);

If you are using Proguard on your project and don’t need or use the Unity framework, you will also need to add the following lines to your Proguard config file:

- dontwarn com.smaato.soma.SomaUnityPlugin*
- dontwarn com.millennialmedia**
- dontwarn com.facebook.**

Using the Smaato Demo App

Within the SDK ZIP file, there’s a demo app that shows an example of how to integrate our SDK, how to use it and how to implement desired options.

The demo app allows you to:

  • Use your Publisher and Adspace IDs.
  • Request multiple ad units (text, image, rich media, medium rectangle, video)
  • Configure refresh time
  • See how a banner can be used across multiple screens
  • Use a classic BannerView
  • Use a full-screen banner
  • Use an interstitial banner
  • Use a toaster banner
  • See how to implement banners directly from your XML layout

Last Modified: February 14, 2020 at 1:59 pm

© 2005-2020 Smaato, Inc. All Rights Reserved. Smaato® is a registered trademark of Smaato, Inc.

Privacy Policy | Cookie Policy | Support