Select platform: [Android (beta)
![New](https://developers.google.com/static/admob/images/new.svg)](https://developers.google.com/admob/android/next-gen/mediation "View this page for the Android (beta) platform docs.") [Android](https://developers.google.com/admob/android/mediation "View this page for the Android platform docs.") [iOS](https://developers.google.com/admob/ios/mediation "View this page for the iOS platform docs.") [Unity](https://developers.google.com/admob/unity/mediation "View this page for the Unity platform docs.") [Flutter](https://developers.google.com/admob/flutter/mediation "View this page for the Flutter platform docs.")

<br />

AdMob Mediation is a feature that lets you serve ads to your apps from
multiple sources, including the AdMob Network and third-party ad sources, in
one place. AdMob Mediation helps maximize your fill rate and increase your
monetization by sending ad requests to multiple networks to verify you find the
best available network to serve ads.
[Case study](https://admob.google.com/home/resources/cookapps-grows-ad-revenue-86-times-with-admob-rewarded-ads-and-mediation/).


## Prerequisites

| **Important:** Verify that you have the necessary account permissions to complete the mediation configuration. These permissions include access to inventory management, app access, and privacy and messaging features. See [Manage user access to your
| account](https://support.google.com/admob/answer/2784628) for details.

Before you can integrate mediation for an ad format, you need to integrate that
ad format into your app:

- [Banner Ads](https://developers.google.com/admob/android/banner)
- [Interstitial Ads](https://developers.google.com/admob/android/interstitial)
- [Native Ads](https://developers.google.com/admob/android/native)
- [Rewarded Ads](https://developers.google.com/admob/android/rewarded)
- [Rewarded Interstitial
  Ads](https://developers.google.com/admob/android/rewarded-interstitial)

New to mediation? Read

[Overview of AdMob Mediation](https://support.google.com/admob/answer/3063564).

For bidding:

Google Mobile Ads SDK 18.3.0
or higher.

## Initialize Google Mobile Ads SDK

The quick start guide shows you how to [initialize the Google Mobile Ads SDK](https://developers.google.com/admob/android/quick-start#initialize_the_mobile_ads_sdk).
During that initialization call, mediation adapters also
get initialized. It is important to wait for initialization to complete before
you load ads in order to verify full participation from every ad network on the
first ad request.
| **Important:** Bidding adapters require you to explicitly initialize Google Mobile Ads SDK.

The following sample code shows how you can check each adapter's initialization
status prior to making an ad request.  

### Java

    public void initialize(Context context) {
      new Thread(
              () ->
                  // Initialize the Google Mobile Ads SDK on a background thread.
                  MobileAds.initialize(context, this::logAdapterStatus))
          .start();
    }

    private void logAdapterStatus(InitializationStatus initializationStatus) {
      // Check each adapter's initialization status.
      Map<String, AdapterStatus> statusMap = initializationStatus.getAdapterStatusMap();
      for (Map.Entry<String, AdapterStatus> entry : statusMap.entrySet()) {
        String adapterClass = entry.getKey();
        AdapterStatus status = entry.getValue();
        Log.d(
            TAG,
            String.format(
                "Adapter name: %s, Description: %s, Latency: %d",
                adapterClass, status.getDescription(), status.getLatency()));
      }
    }  
    https://github.com/googleads/googleads-mobile-android-examples/blob/6252f89e35ae5b73053ed3f74bf551114920b7ad/java/advanced/APIDemo/app/src/main/java/com/google/android/gms/snippets/MediationSnippets.java#L30-L50

### Kotlin

    fun initialize(context: Context) {
      CoroutineScope(Dispatchers.IO).launch {
        // Initialize the Google Mobile Ads SDK on a background thread.
        MobileAds.initialize(context, ::logAdapterStatus)
      }
    }

    private fun logAdapterStatus(initializationStatus: InitializationStatus) {
      // Check each adapter's initialization status.
      for ((adapterClass, status) in initializationStatus.adapterStatusMap) {
        Log.d(
          TAG,
          "Adapter: $adapterClass, Status: ${status.description}, Latency: ${status.latency}ms",
        )
      }
    }  
    https://github.com/googleads/googleads-mobile-android-examples/blob/6252f89e35ae5b73053ed3f74bf551114920b7ad/kotlin/advanced/APIDemo/app/src/main/java/com/google/android/gms/snippets/MediationSnippets.kt#L25-L41

## Check which ad network adapter class loaded the ad

Here is some sample code that logs the ad network class name for a banner ad:  

### Java

    ResponseInfo responseInfo = ad.getResponseInfo();
    String adapterClassName = null;
    if (responseInfo != null) {
      adapterClassName = responseInfo.getMediationAdapterClassName();
    }
    Log.d(TAG, "Adapter class name: " + adapterClassName);  
    https://github.com/googleads/googleads-mobile-android-examples/blob/6252f89e35ae5b73053ed3f74bf551114920b7ad/java/advanced/APIDemo/app/src/main/java/com/google/android/gms/snippets/ResponseInfoSnippets.java#L114-L119

### Kotlin

    Log.d(TAG, "Adapter class name:" + ad.responseInfo?.mediationAdapterClassName)  
    https://github.com/googleads/googleads-mobile-android-examples/blob/6252f89e35ae5b73053ed3f74bf551114920b7ad/kotlin/advanced/APIDemo/app/src/main/java/com/google/android/gms/snippets/ResponseInfoSnippets.kt#L102-L102

Refer to the `ResponseInfo` documentation on `getMediationAdapterClassName()`
for details about this method.

## Initialize your ad object with an Activity instance

In the constructor for a new ad object (for example,

[`AdView`](https://developers.google.com/admob/android/reference/com/google/android/gms/ads/AdView)),

you must pass in an object of type
[`Context`](https://developer.android.com/reference/android/content/Context.html).
This `Context` is passed on to other ad networks when using mediation. Some
ad networks require a more restrictive `Context` that is of type
[`Activity`](https://developer.android.com/reference/android/app/Activity.html)
and may not be able to serve ads without an `Activity` instance. Therefore,
we recommend passing in an `Activity` instance when initializing ad objects
to verify a consistent experience with your mediated ad networks.

<br />

## Use banner ads with AdMob Mediation

Make sure to disable refresh in all third-party ad source UIs for banner ad
units used in AdMob Mediation. This prevents a
double refresh since AdMob also triggers a refresh
based on your banner ad unit's refresh rate.

## Use native ads with AdMob Mediation

The following are some best practices to consider when implementing native
mediation.

Native ad presentation policy
:   Each ad network has its own policies. When using mediation, it's important to
    remember that your app still needs to abide by the policies of the mediated
    network that provided the ad.

Use `loadAd()` instead of `loadAds()`
:   The `loadAds()` method serves only Google ads. For mediated ads, use
    `loadAd()` instead.

## US states privacy laws and GDPR

If you need to comply with the [U.S. states privacy
laws](https://support.google.com/admob/answer/9561022) or [General Data Protection
Regulation (GDPR)](https://support.google.com/admob/answer/7666366), follow the
steps in [US state regulations
settings](https://support.google.com/admob/answer/10860309) or [GDPR
settings](https://support.google.com/admob/answer/10113004#adding_ad_partners_to_published_gdpr_messages) to add your
mediation partners in AdMob Privacy \& messaging's
US states or GDPR ad partners list. Failure to do so can lead to partners
failing to serve ads on your app.

Learn more about enabling [restricted data processing
(RDP)](https://developers.google.com/admob/android/privacy/us-states) and obtaining GDPR consent with the
[Google User Messaging Platform (UMP) SDK](https://developers.google.com/admob/android/privacy).