Preparing Mediated Networks

When you integrate third-party SDKs into your Mobile Property, you are solely responsible for such integrations. You and the third-party SDK provider must ensure compliant data processing and treatment of any end user- or device-based privacy choices or flags.

By , developers & publishers who use Google AdSense, AdManager, or AdMob must use a consent management platform (CMP) that is certified by Google and that integrates with IAB’s Transparency and Consent Framework when they serve ads to users in the European Economic Area (EEA) or the UK. Click here for more information.

  • You can download and integrate the MAX mediation adapters into your app in multiple ways:

    Gradle
    AppLovin recommends that you integrate adapters this way. AppLovin’s adapters’ POM files automatically integrate the mediated network’s SDK along with its dependencies.
    Open Source Adapters
    If you require more flexibility in the integration, you can integrate AppLovin’s open source adapters. Android SDK v11.0.0 is required in order to compile. You are responsible for integrating the mediated SDKs and any dependencies they require. You can find these adapters in the AppLovin-MAX-SDK-Android GitHub repository.
    Manual Integration
    Read the manual integration instructions if you want to integrate adapter artifacts, mediated SDKs, and their dependencies manually.

    Gradle

    Choose which mediated ad networks you want to integrate by checking the boxes below, and this page will display instructions specific to those networks. Then copy the customized UPL below into AppLovinMAX_UPL_Android.xml.

    <AARImports>
    </AARImports>
    
    <buildGradleAdditions>
      <insert>
        allprojects {
          repositories {
            // You may add any additional repositories for other ad networks here
          }
        }
      </insert>
    </buildGradleAdditions>

    Update aar-imports.txt

    Several network SDKs require a newer version of Google Play Services than the one included by default with Unreal Engine, so you’ll need to update the aar-imports.txt based on the Unreal Engine version you’re using. For example, to update the dependency versions for Unreal Engine 4.27 on macOS, you should modify the file located at /Users/Shared/Epic Games/UE_4.27/Engine/Build/Android/Java/aar-imports.txt.

    ⋮
    com.google.android.gms,play-services-auth,16.0.1
    com.google.android.gms,play-services-games,17.0.0
    com.google.android.gms,play-services-nearby,16.0.0
    com.google.android.gms,play-services-plus,16.0.0

    Meta Audience Network Data Processing Options

    If you do not want to enable Limited Data Use (LDU) mode, pass SetDataProcessingOptions() an empty string array:

    ⋮
    <gameActivityImportAdditions>
      ⋮
      import com.facebook.ads.AdSettings;
    </gameActivityImportAdditions>
    
    <gameActivityOnCreateAdditions>
      <insert>
        AdSettings.setDataProcessingOptions( new String[] {} );
      </insert>
    </gameActivityOnCreateAdditions>

    To enable LDU for users and specify user geography, call SetDataProcessingOptions() in a form like this:

    <gameActivityOnCreateAdditions>
      <insert>
        AdSettings.setDataProcessingOptions( new String[] {"LDU"}, 1, 1000 );
      </insert>
    </gameActivityOnCreateAdditions>

    Using Google UMP

    If you use Google UMP as your CMP, you can parse whether the user has consented to Meta or not by using the following code:

    • Boolean hasMetaConsent = AppLovinSdkUtils.getAdditionalConsentStatus( 89, context );
      if ( hasMetaConsent != null )
      {
        // Set Meta Data Processing Options accordingly. 
      }
      else
      {
        // AC String is not available on disk. Please check for consent status after the user completes the CMP flow.
      }
    • val hasMetaConsent = AppLovinSdkUtils.getAdditionalConsentStatus(89, context)
      if ( hasMetaConsent != null )
      {
        // Set Meta Data Processing Options accordingly.
      }
      else
      {
        // AC String is not available on disk. Please check for consent status after the user completes the CMP flow.
      }
      

    Meta Audience Network Data Processing Options for Users in California

    For information about how to implement Meta Audience Network’s “Limited Data Use” flag in California, visit the Meta for Developers documentation.

    Add Your Google Bidding and Google AdMob / Google Ad Manager App ID

    In your app’s AppLovinMAX_UPL_Android.xml, add your Google bidding and Google AdMob App ID under the androidManifestUpdates tag. In the example below, replace your-admob-app-id with your Google bidding and Google AdMob App ID.

    <androidManifestUpdates>
    ⋮
        <addElements tag="application">
            <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="your-admob-app-id" />
        </addElements>
    ⋮
    </androidManifestUpdates>

    Google Mobile Ads SDK versions 20.5.0 and newer require that you set the compileSdkVersion of your app to 31 in build.gradle. Google Mobile Ads SDK version 20.4.0.1 is the most recent version that still supports setting compileSdkVersion to 30.

    Gradle Errors

    Google AdMob updated its SDK to require Android Gradle plugin version 4.2.0 or higher and Gradle version 6.7.1 or higher. If you see the following error, update your Android Gradle plugin and Gradle versions:

    AAPT: error: unexpected element <property> found in <manifest><application>.

    Enable Google Ad Manager

    In your app’s AppLovinMAX_UPL_Android.xml, add a <meta-data> tag inside the application tag, as in the example below:

    <androidManifestUpdates>
    ⋮
      <addElements tag="application">
        <meta-data
            android:name="com.google.android.gms.ads.AD_MANAGER_APP"
            android:value="true" />
      </addElements>
    ⋮
    </androidManifestUpdates>

    Android Manifest Merging Errors

    Several network SDKs use the <queries> element in their bundled Android Manifest files. If you are on an incompatible version of the Android Gradle plugin, this will cause one of the following build errors:

    • com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
      error: unexpected element <queries> found in <manifest>.
    • Missing 'package' key attribute on element package at [:com.my.target.mytarget-sdk-5.11.3:]
      AndroidManifest Validation failed

    To fix this error, upgrade to one of the following versions of the Android Gradle plugin that supports the <queries> element:

    Upgrade the Android Gradle Plugin, not the Gradle Build Tools.

    Current Android Gradle Plugin Version Version that Supports <queries> Element
    4.1.* All
    4.0.* 4.0.1+
    3.6.* 3.6.4+
    3.5.* 3.5.4+
    3.4.* 3.4.3+
    3.3.* 3.3.3+

    To upgrade the Android Gradle plugin, follow these instructions:

    1. Navigate to the directory for your version of the Unreal Engine. For example, Unreal Engine 4.27 on macOS can be found at /Users/Shared/Epic Games/UE_4.27/.
    2. In Engine/Source/Programs/UnrealBuildTool/Platform/Android/UEDeployAndroid.cs, update the value for ANDROID_TOOLS_BUILD_GRADLE_VERSION (replace X.X.X with the appropriate version number):
      private const string ANDROID_TOOLS_BUILD_GRADLE_VERSION = "com.android.tools.build:gradle:X.X.X";
    3. In Engine/Build/Android/Java/gradle/build.gradle update the following line (replace X.X.X with the appropriate version number):
      classpath project.hasProperty('ANDROID_TOOLS_BUILD_GRADLE_VERSION') ? project.property('ANDROID_TOOLS_BUILD_GRADLE_VERSION') : 'com.android.tools.build:gradle:X.X.X'
  • Unreal Engine requires that you manually integrate third-party frameworks for iOS, since it currently does not support dependency managers like CocoaPods. The MAX Unreal GitHub repository includes a Python script — install_pods.py — to assist with automatically installing dependencies from a Podfile. The script downloads AppLovin adapters and third-party dependencies, and configures your project with build settings to link them.

    This Python script may not be able to automatically configure third-party SDKs for certain networks, in which case you must integrate them manually.

    Requirements

    • Python 3.6+
    • CocoaPods

    Ensure that you’re using the latest version of CocoaPods. You can check your version by issuing the following command:

    pod --version

    To update CocoaPods, run one of the following commands:

    Homebrew:
    brew upgrade cocoapods
    RubyGems:
    sudo gem install cocoapods

    Instructions

    1. Download install_pods.py from AppLovin’s MAX Unreal GitHub repository.
    2. Copy this Python script into the Source/ThirdParty/IOS/ directory of the AppLovin MAX Unreal plugin.
    3. Create a Podfile in that directory for the adapters you want to integrate.
    4. Run install_pods.py to download the adapters and dependencies. Follow any additional instructions from the script to complete installation.
    5. Follow the instructions in Preparing Mediated Networks (iOS). Add any necessary changes to Info.plist in AppLovinMAX_UPL_IOS.xml.