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.

This page shows you how to integrate MAX mediation network adapters in your app. Choose which mediated ad networks you want to integrate by checking the boxes below, and this page will display instructions specific to those networks.

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.

iOS-Specific Instructions

Select the ad networks you want to integrate. Then follow the iOS-specific instructions on this page.

Starting from Pangle iOS adapter version 4.9.1.0.0, Pangle is no longer available in Chinese Mainland. If you wish to monetize Chinese Mainland traffic, please set up the CSJ network and add the CSJ adapter. For global traffic excluding Chinese Mainland, you can continue to use Pangle for monetization.

Add Your Google Bidding and Google AdMob App IDs

Open the Integration Manager (AppLovin > Integration Manager) and install the latest Google bidding and Google AdMob adapter: Click Install in the Actions column next to Google bidding and Google AdMob in the Mediated Networks section of the Integration Manager, then click Import in the Import Unity Package dialog. Two new fields for your App IDs will appear in the Mediated Networks section of the Integration Manager. Enter the corresponding values there.

Google bidding and Google AdMob. App ID (Android). App ID (iOS).

Meta Audience Network SDK Migration

If your project uses the Meta Audience Network Unity SDK, you must be on version 11.0 or later for the MAX Meta Audience Network adapter to function. To migrate from an older version of Meta Audience Network Unity SDK, delete the Assets/FacebookSDK directory, then download and re-import the latest version here.

Meta Audience Network Data Processing Options

If you aren’t using the Meta Audience Network Unity Plugin, you can follow the instructions here under “Unity SDK, v5.10+ (not using the Audience Network-supplied Unity wrapper)” to add a wrapper for the relevant methods.

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

using AudienceNetwork;
⋮
AdSettings.SetDataProcessingOptions(new string[] { });
⋮
// Initialize MAX SDK

If you want to enable LDU for users and to specify user geography, call SetDataProcessingOptions() in a form like this:

using AudienceNetwork;
⋮
AdSettings.SetDataProcessingOptions(new string[] {"LDU"}, 1, 1000);
⋮
// Initialize MAX SDK

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:

bool? hasMetaConsent = MaxSdkUtils.GetAdditionalConsentStatus(89);
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.

Meta Preparing For iOS 14.5 and Above

Version 6.2.1 of Audience Network SDK was released on 11 January 2021. This version has the following important requirement:

  • Implement the setAdvertiserTrackingEnabled flag, irrespective of the use of mediation, to inform Meta whether to use the data to deliver personalized ads.
MaxSdkCallbacks.OnSdkInitializedEvent += (MaxSdkBase.SdkConfiguration sdkConfiguration) => {

#if UNITY_IOS || UNITY_IPHONE || UNITY_EDITOR
  if (MaxSdkUtils.CompareVersions(UnityEngine.iOS.Device.systemVersion, "14.5") != MaxSdkUtils.VersionComparisonResult.Lesser)
  {
    // Note that App transparency tracking authorization can be checked via `sdkConfiguration.AppTrackingStatus` for Unity Editor and iOS targets
    // 1. Set Meta ATE flag here, THEN
  }
#endif

  // 2. Load ads
};

SKAdNetwork

The Integration Manager automatically integrates SKAdNetwork IDs of integrated networks on your behalf.

Android-Specific Instructions

Select the ad networks you want to integrate. Then follow the Android-specific instructions on this page.

Add Your Google Bidding and Google AdMob App IDs

Open the Integration Manager (AppLovin > Integration Manager) and install the latest Google bidding and Google AdMob adapter: Click Install in the Actions column next to Google bidding and Google AdMob in the Mediated Networks section of the Integration Manager, then click Import in the Import Unity Package dialog. Two new fields for your App IDs will appear in the Mediated Networks section of the Integration Manager. Enter the corresponding values there.

Google bidding and Google AdMob. App ID (Android). App ID (iOS).

Meta Audience Network SDK Migration

If your project uses the Meta Audience Network Unity SDK, you must be on version 11.0 or later for the MAX Meta Audience Network adapter to function. To migrate from an older version of Meta Audience Network Unity SDK, delete the Assets/FacebookSDK directory, then download and re-import the latest version here.

Meta Audience Network Data Processing Options

If you aren’t using the Meta Audience Network Unity Plugin, you can follow the instructions here under “Unity SDK, v5.10+ (not using the Audience Network-supplied Unity wrapper)” to add a wrapper for the relevant methods.

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

using AudienceNetwork;
⋮
AdSettings.SetDataProcessingOptions(new string[] { });
⋮
// Initialize MAX SDK

If you want to enable LDU for users and to specify user geography, call SetDataProcessingOptions() in a form like this:

using AudienceNetwork;
⋮
AdSettings.SetDataProcessingOptions(new string[] {"LDU"}, 1, 1000);
⋮
// Initialize MAX SDK

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:

bool? hasMetaConsent = MaxSdkUtils.GetAdditionalConsentStatus(89);
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.

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 update the Gradle Plugin version to a compatible one, enable the custom base Gradle template: select Edit > Project Settings…, then choose Player and select the tab labeled with the Android icon, then open Publisher Settings and check Custom Base Gradle Template.

The template is located at Assets/Plugins/Android/mainTemplate.gradle for Unity 2019.2 or below and Assets/Plugins/Android/baseProjectTemplate.gradle for Unity 2019.3 or above. In that template, update the line below with the appropriate Gradle version:

classpath com.android.tools.build:gradle:x.x.x

If you are on Unity 2017.4, ensure that you are on at least 2017.4.40 which uses a compatible version of the Gradle Plugin by default.

Minimum API Level Required

Nend requires Android API 19 (KitKat 4.4–4.4.4) or higher.

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.

Network Security Configuration File

For Meta Audience Network to function correctly, you must permit cleartext traffic (at least for certain domains) by using Android’s Network Security Configuration feature. It is also recommended, but not required, that you permit cleartext traffic for AdColony.

If you use AdColony, you may permit all cleartext traffic. If you use Meta Audience Network, you must permit cleartext traffic for localhost (127.0.0.1). You can accomplish this by creating or editing your network_security_config.xml file. If you have not already created this file, create a new XML file in Plugins/Android/res/xml/ called network_security_config.xml. Then in your application manifest Assets/Plugins/Android/AndroidManifest.xml (if you don’t have one, you need to create it), add the configuration to your application attribute as follows:

<?xml version="1.0" encoding="utf-8"?>
<manifest … >
  <application android:networkSecurityConfig="@xml/network_security_config"
        … >
    ⋮
  </application>
</manifest>

In the res/xml/network_security_config.xml file, add sections that permit cleartext traffic for the networks that require this:

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>

  <!-- For AdColony, this permits all cleartext traffic: -->
  <base-config cleartextTrafficPermitted="true">
    <trust-anchors>
      <certificates src="system"/>
    </trust-anchors>
  </base-config>
  <!-- End AdColony section -->

  <domain-config cleartextTrafficPermitted="true">

    <!-- For Meta Audience Network, this permits cleartext traffic to localhost: -->
    <domain includeSubdomains="true">127.0.0.1</domain>
    <!-- End Meta Audience Network section -->

  </domain-config>
</network-security-config>

To integrate Amazon for Unity, refer to the Amazon Publisher Services Integration Instructions page.

Integration Manager

You can access the AppLovin Integration Manager from your Unity IDE in order to install or upgrade mediation adapters and the mediation plugin itself.

To launch the Integration Manager, select AppLovin > Integration Manager from the Unity menu bar.

Unity Menu To Integration Manager

This displays a pop up window with a list of available mediation networks. You can Install or Upgrade ad networks by clicking buttons in the Action column.

AppLovin Integration Manager Window