Stay organized with collections
Save and categorize content based on your preferences.
AdMob Mediation is a feature 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.
Prerequisites
Before you can integrate mediation for an ad format, you need to integrate that
ad format into your app:
The quick start guide shows you how to initialize the Next Gen 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.
The following sample code shows how you can check each adapter's initialization
status prior to making an ad request.
Kotlin
importcom.google.android.libraries.ads.mobile.sdk.MobileAdsimportcom.google.android.libraries.ads.mobile.sdk.initialization.InitializationConfigimportkotlinx.coroutines.CoroutineScopeimportkotlinx.coroutines.Dispatchersimportkotlinx.coroutines.launchclassMainActivity:AppCompatActivity(){overridefunonCreate(savedInstanceState:Bundle?){super.onCreate(savedInstanceState)setContentView(R.layout.activity_main)valbackgroundScope=CoroutineScope(Dispatchers.IO)backgroundScope.launch{// Initialize Next Gen Mobile Ads SDK on a background thread.MobileAds.initialize(this@MainActivity,InitializationConfig.Builder("SAMPLE_APP_ID").build()){initializationStatus->
for((adapterName,adapterStatus)ininitializationStatus.adapterStatusMap){Log.d("MyApp",String.format("Adapter name: %s, Status code: %s, Status string: %s, Latency: %d",adapterName,adapterStatus.initializationState,adapterStatus.description,adapterStatus.latency,),)}// Adapter initialization is complete.}// Other methods on MobileAds can now be called.}}}
Java
importcom.google.android.libraries.ads.mobile.sdk.MobileAds;importcom.google.android.libraries.ads.mobile.sdk.initialization.AdapterStatus;importcom.google.android.libraries.ads.mobile.sdk.initialization.InitializationConfig;publicclassMainActivityextendsAppCompatActivity{protectedvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);newThread(()->{// Initialize Next Gen Mobile Ads SDK on a background thread.MobileAds.initialize(this,newInitializationConfig.Builder("SAMPLE_APP_ID").build(),initializationStatus->{Map<String,AdapterStatus>adapterStatusMap=initializationStatus.getAdapterStatusMap();for(StringadapterClass:adapterStatusMap.keySet()){AdapterStatusadapterStatus=adapterStatusMap.get(adapterClass);Log.d("MyApp",String.format("Adapter name: %s, Status code: %s, Status description: %s,"+" Latency: %d",adapterClass,adapterStatus.getInitializationState(),adapterStatus.getDescription(),adapterStatus.getLatency()));}// Adapter initialization is complete.});// Other methods on MobileAds can now be called.}).start();}}
Exclude com.google.android.gms modules in mediation integrations
Mediation adapters continue to depend on the current Next Gen Mobile Ads SDK. However,
Next Gen Mobile Ads SDK includes all classes required by mediation adapters.
To avoid compile errors related to duplicate symbols, you need to exclude the
current Next Gen Mobile Ads SDK from being pulled in as a dependency by mediation
adapters.
In your app-level build.gradle file, exclude both play-services-ads and
play-services-ads-lite modules globally from all dependencies.
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:
Kotlin
BannerAd.load(BannerAdRequest.Builder("AD_UNIT_ID",AdSize.BANNER).build(),object:AdLoadCallback<BannerAd>{overridefunonAdLoaded(ad:BannerAd){Log.d("MyApp","Adapter class name: "+ad.getResponseInfo().mediationAdapterClassName)}})
Java
BannerAd.load(newBannerAdRequest.Builder("AD_UNIT_ID",AdSize.BANNER).build(),newAdLoadCallback<BannerAd>(){@OverridepublicvoidonAdLoaded(@NonNullBannerAdad){Log.d("MyApp","Adapter class name: "+ad.getResponseInfo().getMediationAdapterClassName());}});
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[[["\u003cp\u003eAdMob Mediation lets you maximize ad revenue by serving ads from multiple ad networks, including AdMob and third-party sources.\u003c/p\u003e\n"],["\u003cp\u003eBefore integrating mediation, ensure you have the necessary account permissions and have integrated the desired ad formats into your app.\u003c/p\u003e\n"],["\u003cp\u003eInitialize the Mobile Ads SDK to enable mediation adapters and ensure all ad networks participate in ad requests.\u003c/p\u003e\n"],["\u003cp\u003eTo avoid compile errors, exclude the current Mobile Ads SDK (\u003ccode\u003eplay-services-ads\u003c/code\u003e and \u003ccode\u003eplay-services-ads-lite\u003c/code\u003e) from your dependencies.\u003c/p\u003e\n"],["\u003cp\u003eFor banner ads used with AdMob Mediation, disable refresh in third-party ad source UIs to prevent double refreshing.\u003c/p\u003e\n"]]],["AdMob Mediation allows serving ads from multiple sources, maximizing fill rates and monetization. Key actions include initializing the Mobile Ads SDK, checking adapter initialization status, and excluding `play-services-ads` and `play-services-ads-lite` modules. Developers can verify the ad network adapter that loaded the ad. For banner ads, refresh must be disabled in third-party ad sources. For compliance with US state privacy laws and GDPR, mediation partners should be added to AdMob Privacy settings.\n"],null,["AdMob Mediation is a feature lets you serve ads to your apps from\nmultiple sources, including the AdMob Network and third-party ad sources, in\none place. AdMob Mediation helps maximize your fill rate and increase your\nmonetization by sending ad requests to multiple networks to verify you find the\nbest available network to serve ads.\n[Case study](//admob.google.com/home/resources/cookapps-grows-ad-revenue-86-times-with-admob-rewarded-ads-and-mediation/).\n\n\nPrerequisites **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\n| account](//support.google.com/admob/answer/2784628) for details.\n\nBefore you can integrate mediation for an ad format, you need to integrate that\nad format into your app:\n\n- [Banner Ads](/admob/android/early-access/nextgen/banner)\n- [Interstitial Ads](/admob/android/early-access/nextgen/interstitial)\n- [Native Ads](/admob/android/early-access/nextgen/native)\n- [Rewarded Ads](/admob/android/early-access/nextgen/rewarded)\n- [Rewarded Interstitial\n Ads](/admob/android/early-access/nextgen/rewarded-interstitial)\n\nNew to mediation? Read\n\n[Overview of AdMob Mediation](//support.google.com/admob/answer/3063564).\n\nInitialize Next Gen Mobile Ads SDK\n\nThe quick start guide shows you how to [initialize the Next Gen Mobile Ads SDK](/admob/android/early-access/nextgen/quick-start#initialize_the_mobile_ads_sdk).\nDuring that initialization call, mediation adapters also\nget initialized. It is important to wait for initialization to complete before\nyou load ads in order to verify full participation from every ad network on the\nfirst ad request.\n| **Important:** Bidding adapters require you to explicitly initialize Next Gen Mobile Ads SDK.\n\nThe following sample code shows how you can check each adapter's initialization\nstatus prior to making an ad request. \n\nKotlin \n\n import com.google.android.libraries.ads.mobile.sdk.MobileAds\n import com.google.android.libraries.ads.mobile.sdk.initialization.InitializationConfig\n import kotlinx.coroutines.CoroutineScope\n import kotlinx.coroutines.Dispatchers\n import kotlinx.coroutines.launch\n\n class MainActivity : AppCompatActivity() {\n override fun onCreate(savedInstanceState: Bundle?) {\n super.onCreate(savedInstanceState)\n setContentView(R.layout.activity_main)\n\n val backgroundScope = CoroutineScope(Dispatchers.IO)\n backgroundScope.launch {\n // Initialize Next Gen Mobile Ads SDK on a background thread.\n MobileAds.initialize(this@MainActivity, InitializationConfig.Builder(\"\u003cvar class=\"readonly\" translate=\"no\"\u003eSAMPLE_APP_ID\u003c/var\u003e\").build()) {\n initializationStatus -\\\u003e\n for ((adapterName, adapterStatus) in initializationStatus.adapterStatusMap) {\n Log.d(\n \"MyApp\",\n String.format(\n \"Adapter name: %s, Status code: %s, Status string: %s, Latency: %d\",\n adapterName,\n adapterStatus.initializationState,\n adapterStatus.description,\n adapterStatus.latency,\n ),\n )\n }\n // Adapter initialization is complete.\n }\n // Other methods on MobileAds can now be called.\n }\n }\n }\n\nJava \n\n import com.google.android.libraries.ads.mobile.sdk.MobileAds;\n import com.google.android.libraries.ads.mobile.sdk.initialization.AdapterStatus;\n import com.google.android.libraries.ads.mobile.sdk.initialization.InitializationConfig;\n\n public class MainActivity extends AppCompatActivity {\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_main);\n\n new Thread(\n () -\\\u003e {\n // Initialize Next Gen Mobile Ads SDK on a background thread.\n MobileAds.initialize(\n this,\n new InitializationConfig.Builder(\"\u003cvar class=\"readonly\" translate=\"no\"\u003eSAMPLE_APP_ID\u003c/var\u003e\")\n .build(),\n initializationStatus -\\\u003e {\n Map\\\u003cString, AdapterStatus\\\u003e adapterStatusMap =\n initializationStatus.getAdapterStatusMap();\n for (String adapterClass : adapterStatusMap.keySet()) {\n AdapterStatus adapterStatus = adapterStatusMap.get(adapterClass);\n Log.d(\n \"MyApp\",\n String.format(\n \"Adapter name: %s, Status code: %s, Status description: %s,\"\n + \" Latency: %d\",\n adapterClass,\n adapterStatus.getInitializationState(),\n adapterStatus.getDescription(),\n adapterStatus.getLatency()));\n }\n // Adapter initialization is complete.\n });\n // Other methods on MobileAds can now be called.\n })\n .start();\n }\n }\n\nExclude `com.google.android.gms` modules in mediation integrations\n\nMediation adapters continue to depend on the current Next Gen Mobile Ads SDK. However,\nNext Gen Mobile Ads SDK includes all classes required by mediation adapters.\nTo avoid compile errors related to duplicate symbols, you need to exclude the\ncurrent Next Gen Mobile Ads SDK from being pulled in as a dependency by mediation\nadapters.\n\nIn your app-level `build.gradle` file, exclude both `play-services-ads` and\n`play-services-ads-lite` modules globally from all dependencies. \n\n configurations {\n all {\n exclude(group = \"com.google.android.gms\", module = \"play-services-ads\")\n exclude(group = \"com.google.android.gms\", module = \"play-services-ads-lite\")\n }\n }\n\nCheck which ad network adapter class loaded the ad\n\nHere is some sample code that logs the ad network class name for a banner ad: \n\nKotlin \n\n BannerAd.load(\n BannerAdRequest.Builder(\"\u003cvar class=\"readonly\" translate=\"no\"\u003eAD_UNIT_ID\u003c/var\u003e\", AdSize.BANNER).build(),\n object : AdLoadCallback\u003cBannerAd\u003e {\n override fun onAdLoaded(ad: BannerAd) {\n Log.d(\n \"MyApp\", \"Adapter class name: \" +\n ad.getResponseInfo().mediationAdapterClassName\n )\n }\n }\n )\n\nJava \n\n BannerAd.load(\n new BannerAdRequest.Builder(\"\u003cvar class=\"readonly\" translate=\"no\"\u003eAD_UNIT_ID\u003c/var\u003e\", AdSize.BANNER).build(),\n new AdLoadCallback\u003cBannerAd\u003e() {\n @Override\n public void onAdLoaded(@NonNull BannerAd ad) {\n Log.d(\"MyApp\",\n \"Adapter class name: \" + ad.getResponseInfo().getMediationAdapterClassName());\n }\n }\n );\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nUse banner ads with AdMob Mediation\n\nMake sure to disable refresh in all third-party ad source UIs for banner ad\nunits used in AdMob Mediation. This prevents a double refresh since\nAdMob also triggers a refresh based on your banner ad unit's\nrefresh rate.\n\n\u003cbr /\u003e\n\nUS states privacy laws and GDPR\n\nIf you need to comply with the [U.S. states privacy\nlaws](//support.google.com/admob/answer/9561022) or [General Data Protection\nRegulation (GDPR)](//support.google.com/admob/answer/7666366), follow the\nsteps in [US state regulations\nsettings](//support.google.com/admob/answer/10860309) or [GDPR\nsettings](//support.google.com/admob/answer/10113004#adding_ad_partners_to_published_gdpr_messages) to add your\nmediation partners in AdMob Privacy \\& messaging's\nUS states or GDPR ad partners list. Failure to do so can lead to partners\nfailing to serve ads on your app.\n\nLearn more about enabling [restricted data processing\n(RDP)](/admob/android/early-access/nextgen/privacy/us-states) and obtaining GDPR consent with the\n[Google User Messaging Platform (UMP) SDK](/admob/android/privacy)."]]