Android SDK Integration

Integrating the SDK

The easiest way to integrate SDK to your Android project is to use Maven Repository.

Step 1: Simply open your project's app level build.gradle file and add the AppLovin SDK as dependency:

implementation 'com.applovin:applovin-sdk:12.5.0'

Update Your AndroidManifest.xml

Replace value with your app id that will be provided by us by adding following lines to AndroidManifest.xml:

<application>
<!-- Sample Ad Manager app ID: ca-app-pub-3940256099942544~3347511713 -->
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy"/>
</application>

Note: value will be provided by us.

Note:

The SDK collects the Google Advertising ID. This requires the Android Advertising ID(AAID) module. Therefore, add following line to your build.gradle file as a dependency:

implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1'

Initialize the SDK

Kotlin

class MainActivity : Activity()
{
override fun onCreate(savedInstanceState: Bundle?)
{
// Create the initialization configuration
val initConfig = AppLovinSdkInitializationConfiguration.builder("LViME7X7lxKv-i-F_7zqiS5mftIkLozQDU3EVbAPn80KLVP7ImNA15ows7wdxZeVHHT-R_lIJO9TwH5bAxm7_N", this)
.setMediationProvider(AppLovinMediationProvider.MAX)
.build()
// Initialize the SDK with the configuration
AppLovinSdk.getInstance(this).initialize(initConfig) { sdkConfig ->
// Start loading ads
}
}
}

Java

public class MainActivity extends Activity
{
protected void onCreate(Bundle savedInstanceState)
{
// Create the initialization configuration
val initConfig = AppLovinSdkInitializationConfiguration.builder( "LViME7X7lxKv-i-F_7zqiS5mftIkLozQDU3EVbAPn80KLVP7ImNA15ows7wdxZeVHHT-R_lIJO9TwH5bAxm7_N", this )
.setMediationProvider( AppLovinMediationProvider.MAX )
.build();
// Initialize the SDK with the configuration
AppLovinSdk.getInstance( this ).initialize( initConfig, new AppLovinSdk.SdkInitializationListener()
{
@Override
public void onSdkInitialized(final AppLovinSdkConfiguration sdkConfig)
{
// Start loading ads
}
} );
}
}

Enable Creative Debugger

Java

AppLovinSdk.getInstance( context ).getSettings().setCreativeDebuggerEnabled( true );

Kotlin

AppLovinSdk.getInstance( context ).settings.setCreativeDebuggerEnabled( true )

Integrating Mediation Networks

Add maven repositories url for the mediations networks to you project level build.gradle file.

repositories {
google()
mavenCentral()
maven { url "https://cboost.jfrog.io/artifactory/chartboost-ads/" }
maven { url "https://android-sdk.is.com" }
maven { url "https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea" }
maven { url "https://artifact.bytedance.com/repository/pangle" }
maven { url "https://s3.amazonaws.com/smaato-sdk-releases/" }
maven { url "https://repo.pubmatic.com/artifactory/public-repos" }
maven { url "https://ysonetwork.s3.eu-west-3.amazonaws.com/sdk/android" }
}
repositories {
google()
mavenCentral()
maven { url = uri("https://cboost.jfrog.io/artifactory/chartboost-ads/") }
maven { url = uri("https://android-sdk.is.com") }
maven { url = uri("https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea") }
maven { url = uri("https://artifact.bytedance.com/repository/pangle") }
maven { url = uri("https://s3.amazonaws.com/smaato-sdk-releases/") }
maven { url = uri("https://repo.pubmatic.com/artifactory/public-repos") }
maven { url = uri("https://ysonetwork.s3.eu-west-3.amazonaws.com/sdk/android") }
}

Add following dependencies for mediation networks in app.level build.gradle file:

Groovy

dependencies {
implementation 'com.applovin:applovin-sdk:13.0.0'
implementation 'com.applovin.mediation:amazon-tam-adapter:9.10.2.0'
implementation 'com.amazon.android:aps-sdk:9.10.2'
implementation 'com.applovin.mediation:chartboost-adapter:9.7.0.3'
implementation 'com.google.android.gms:play-services-base:16.1.0'
implementation 'com.applovin.mediation:fyber-adapter:8.3.0.0'
implementation 'com.applovin.mediation:google-ad-manager-adapter:23.3.0.1'
implementation 'com.applovin.mediation:google-adapter:23.3.0.1'
implementation 'com.applovin.mediation:inmobi-adapter:10.7.7.2'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'com.applovin.mediation:ironsource-adapter:8.3.0.0.2'
implementation 'com.applovin.mediation:vungle-adapter:7.4.1.2'
implementation 'com.applovin.mediation:facebook-adapter:6.18.0.0'
implementation 'com.applovin.mediation:mintegral-adapter:16.8.51.2'
implementation 'com.applovin.mediation:moloco-adapter:3.2.0.0'
implementation 'com.applovin.mediation:bytedance-adapter:6.2.0.6.0'
implementation 'com.applovin.mediation:smaato-adapter:22.7.0.1'
implementation 'com.applovin.mediation:unityads-adapter:4.12.3.0'
implementation 'com.applovin.mediation:yandex-adapter:7.5.0.0'
implementation 'com.applovin.mediation:yso-network-adapter:1.2.6.0'
implementation 'com.applovin.mediation:bigoads-adapter:4.9.1.0'
implementation 'com.applovin.mediation:pubmatic-adapter:4.0.0.0'
}

Kotlin DSL

dependencies {
implementation ("com.applovin:applovin-sdk:13.0.0")
implementation ("com.applovin.mediation:amazon-tam-adapter:9.10.2.0")
implementation ("com.amazon.android:aps-sdk:9.10.2")
implementation ("com.applovin.mediation:chartboost-adapter:9.7.0.3")
implementation ("com.google.android.gms:play-services-base:16.1.0")
implementation ("com.applovin.mediation:fyber-adapter:8.3.0.0")
implementation ("com.applovin.mediation:google-ad-manager-adapter:23.3.0.1")
implementation ("com.applovin.mediation:google-adapter:23.3.0.1")
implementation ("com.applovin.mediation:inmobi-adapter:10.7.7.2")
implementation ("com.squareup.picasso:picasso:2.71828")
implementation ("androidx.recyclerview:recyclerview:1.1.0")
implementation ("com.applovin.mediation:ironsource-adapter:8.3.0.0.2")
implementation ("com.applovin.mediation:vungle-adapter:7.4.1.2")
implementation ("com.applovin.mediation:facebook-adapter:6.18.0.0")
implementation ("com.applovin.mediation:mintegral-adapter:16.8.51.2")
implementation ("com.applovin.mediation:moloco-adapter:3.2.0.0")
implementation ("com.applovin.mediation:bytedance-adapter:6.2.0.6.0")
implementation ("com.applovin.mediation:smaato-adapter:22.7.0.1")
implementation ("com.applovin.mediation:unityads-adapter:4.12.3.0")
implementation ("com.applovin.mediation:yandex-adapter:7.5.0.0")
implementation ("com.applovin.mediation:yso-network-adapter:1.2.6.0")
implementation ("com.applovin.mediation:bigoads-adapter:4.9.1.0")
implementation("com.applovin.mediation:pubmatic-adapter:4.0.0.0")
}

Enable Google Ad Manager

In your app’s AndroidManifest.xml, add a meta-data tag inside the application tag. The following example shows the correct attributes of this tag:

<?xml version="1.0" encoding="utf-8"?>
<manifest … >
<application … >
<meta-data
android:name="com.google.android.gms.ads.AD_MANAGER_APP"
android:value="true"/>
</application>
</manifest>

Initialize Amazon SDK

// Amazon requires an 'Activity' instance
AdRegistration.getInstance( "AMAZON_APP_ID", this );
AdRegistration.setAdNetworkInfo( new DTBAdNetworkInfo( DTBAdNetwork.MAX ) );
AdRegistration.setMRAIDSupportedVersions( new String[] { "1.0", "2.0", "3.0" } );
AdRegistration.setMRAIDPolicy( MRAIDPolicy.CUSTOM );

Note: AMAZON_APP_ID will be provided by us.

Consent Management

Google UMP

Add following line to the app.level build.gradle file:

implementation 'com.google.android.ump:user-messaging-platform:2.1.0'

To enable AppLovin MAX Google UMP consent flow via Android resources:

Under your resource directory's raw folder, create JSON file named applovin_settings.json and add the following lines into it:

{
"consent_flow_settings": {
"consent_flow_enabled": true,
"consent_flow_terms_of_service": "«https://your_company_name.com/terms_of_service»",
"consent_flow_privacy_policy": "«https://your_company_name.com/privacy_policy»"
}
}