2.5.10 Android SDK Integration Guide

Get started

1. Get the app key

Add your app to Appodeal and get the app key for your application, as it is used during SDK integration.

2. Link your Admob account to Appodeal

Appodeal yields optimal results in cooperation with Admob. Use our application to link them. The application will allow Appodeal to access your Admob reports over API, and will create new ad units on Admob and submit them to Appodeal. Please, see this page for more information.

If you don't have Admob account, please sign up on  admob.com .


General Data Protection Regulation (GDPR) compliance

Publishers need to update their apps to collect the user consent prior to initializing our SDK (Read our guide on collecting consent  here ).

Publishers need to pass the boolean consent flag(with 'false' meaning that the user declined to give the consent) to the  Appodeal.initialize()  method of our SDK.

Appodeal.initialize(this, "YOUR_APPODEAL_APP_KEY", adTypes, consentValue);

Integrate SDK

1. Choose your integration type 

You can use our  demo app  as a reference project.

Minimum requirements:

Android API level 14 (Android OS 4.0), but you can integrate the Appodeal SDK in apps with lower minSdkVersion. On the devices that don't support Android 4.0+, our SDK will just be disabled.

Mediation A/B testing

If you want to compare Appodeal's performance to another mediation, please follow this Mediation A/B testing guide .

You can integrate  Android SDK 2.5.10  with major native ads improvements, segment v2 support, GDPR compliance and Parallel Bidding support.

There are two ways to integrate the SDK:

Import SDK

Apps can import the Appodeal SDK with a Gradle dependency that points to the Maven repository. In order to use that repository, you need to reference it in the app's  project-level build.gradle file. Open yours and look for an allprojects section:

1. Add the Appodeal maven repository

Example project-level build.gradle:

repositories {
	// ... other project repositories
	maven { url "https://artifactory.appodeal.com/appodeal" }
}

2. Add maven dependencies

Next, open the app-level build.gradle file for your app, and look for the dependencies section.

Add one of the lines in bold below , which instruct Gradle to pull in the latest version of the Appodeal SDK.

Use:

  • implementation com.appodeal.ads:nodex:2.5.10 - for Nodex version;
  • implementation com.appodeal.ads:maxdex:2.5.10  - for MaxDex version.

If you're using AndroidX in your app, make sure to use NoDex SDK version with enabled Jetifier

Example app-level build.gradle:

dependencies {
	// ... other project dependencies
	
	//NoDex version
	implementation 'com.appodeal.ads:nodex:2.5.10'

	//MaxDex version (if you don't use Mutlidex)
	//implementation 'com.appodeal.ads:maxdex:2.5.10'

	//Optional SDKs and libraries
	implementation 'com.appodeal.optional:flurry-ads:11.6.0'
	implementation 'com.appodeal.optional:flurry-analytics:11.6.0'
}
  • Add Google Play Services dependencies (15.0.0 and up only):
dependencies {
	// ... other project dependencies
	implementation 'com.google.android.gms:play-services-ads:15.0.0'
	implementation 'com.google.android.gms:play-services-location:15.0.0'
}
  • Add dependencies required for myTarget SDK:
dependencies {
	// ... other project dependencies
	implementation 'com.google.android.exoplayer:exoplayer-core:2.8.4'
	implementation 'com.google.android.exoplayer:exoplayer-hls:2.8.4'
}
dependencies {
	// ... other project dependencies
	implementation 'com.android.support:support-v4:26.1.0'
	implementation 'com.android.support:recyclerview-v7:26.1.0'
}

RecyclerView is required for Inmobi, myTarget, Mopub to ensure the ads work correctly. The absence of RecyclerView may lead to app crash .

  • Some networks are using Java 8 features (e.g - Smaato), so please make sure your Android Gradle plugin version greater or equal 3.2.0 and add next compile options to your app-level build.gradle:

android {
    // ... other options
    
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}
  • If your app is targeting API level 28 (Android 9.0) or above, make sure to specify the requirement for Apache HTTP Legacy library. Include the following declaration within the <application> element of AndroidManifest.xml:

 <uses-library
     android:name="org.apache.http.legacy"
     android:required="false" />
Once that's done, save the file and perform the  Gradle sync .

3. Optional SDKs and libraries

If you do not want to add the Flurry SDK, please delete the dependencies below from your build.gradle file:

dependencies {
    // ... other project dependencies
	implementation 'com.appodeal.optional:flurry-ads:11.6.0'
	implementation 'com.appodeal.optional:flurry-analytics:11.6.0'
}

4. Configure AndroidManifest.xml

  • Add the required permissions to your AndroidManifest.xml file under the manifest tag:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
  • Add the optional permissions to your  AndroidManifest.xml  file under the  manifest  tag to improve ad targeting:

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <!--optional-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <!--optional-->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <!--optional-->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <!--optional-->
<uses-permission android:name="android.permission.VIBRATE" /><!--optional-->

  • Add the following permissions necessary for the  Mintegral  network to work correctly to your AndroidManifest.xml under manifest tag:
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"/> <!--optional-->

2. Network security configuration

Android 9.0 (API 28) blocks cleartext (non-HTTPS) traffic by default, which can prevent ads from serving correctly. Read more on this  here .

1. Add the  Network Security Configuration  file to your  AndroidManifest.xml :

<?xml version="1.0" encoding="utf-8"?>
<manifest>
    <application 
		...
        android:networkSecurityConfig="@xml/network_security_config">
    </application>
</manifest>
2. In your  network_security_config.xml  file, add  base-config  that sets  cleartextTrafficPermitted  to  true :
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config cleartextTrafficPermitted="true">
        <trust-anchors>
            <certificates src="system" />
            <certificates src="user" />
        </trust-anchors>
    </base-config>
    <domain-config cleartextTrafficPermitted="true">
        <domain includeSubdomains="true">127.0.0.1</domain>
    </domain-config>
</network-security-config>

3. Admob Configuration

Make sure to add Privacy Policy to your app on Google Play that links to  Appodeal's Privacy Policy  to avoid violating  Google Play Developer Distribution Agreement .

For version 15.0.0 and higher add the lines below to the dependencies section your build.gradle file:

dependencies {
	// ... other project dependencies
	implementation 'com.google.android.gms:play-services-ads:15.0.0'
	implementation 'com.google.android.gms:play-services-location:15.0.0'
}

If you use Play Services version 17 and higher, add <meta-data> tag to the AndroidManifest file. 

<manifest>
	<application>
		<meta-data
			android:name="com.google.android.gms.ads.APPLICATION_ID"
			android:value="[ADMOB_APP_ID]"/>
	</application>
</manifest>

4. Initialize SDK

To initialize SDK add the line below to onCreate method of your main activity:

Appodeal.initialize(this, "YOUR_APPODEAL_APP_KEY", adTypes, consentValue);
consentValue is boolean, with 'false' meaning that the user declines to give the consent. Read our guide on collecting consent here.

Make sure to replace "YOUR_APPODEAL_APP_KEY" with the actual app key.

Use the type codes below to set the preferred ad format:

  • Appodeal.INTERSTITIAL for interstitial;
  • Appodeal.REWARDED_VIDEO for rewarded videos;
  • Appodeal.NON_SKIPPABLE_VIDEO for non-skippable videos;
  • Appodeal.NATIVE for native ads;
  • Appodeal.BANNER for banners;
  • Appodeal.MREC for 300*250 banners.

Please note:

Ad types can be combined using "|" operator. For example, Appodeal.INTERSTITIAL | Appodeal.REWARDED_VIDEO.

Appodeal.NON_SKIPPABLE_VIDEO - the alias of Appodeal.REWARDED_VIDEO. Both of them shouldn't be used together.

If you are not sure, which ad formats would suit you the best, check out our  FAQ .

It’s done!

You are ready to use Appodeal and implement ad types . If you have any questions, check out our  FAQ  or contact the support team.

Third-party SDKs versions

NetworkSDK version
Adcolony4.1.0
Admob15.0.0
Amazon Ads5.9.0
Applovin9.9.2
Chartboost7.3.1
Facebook Audience Network5.5.0
Flurry11.6.0
Inmobi7.2.7
IronSource6.8.2
Mintegral9.13.21
myTarget5.4.7
Ogury3.0.36
Smaato 21.1.3
Startapp4.0.2
Tapjoy12.3.1
Unity Ads3.0.1
Vungle6.3.24
Yandex Metrica3.8.0
Yandex Mobile Ads2.110