Mediation

Configure AdMob mediation adapters for React Native Google Mobile Ads.

Mediation asks more than one ad network for an ad, including AdMob, and serves the one that wins. Use it when you want a higher chance of a filled request. This page is how you add the adapters for this library.

Configure mediation in the AdMob UI

To configure mediation in the AdMob UI, complete the following steps:

  1. Choose an ad source from the network details table (Android | iOS).
  2. Follow steps 1-2 of that ad source's integration guide.

Install mediation adapters

For the Google Mobile Ads SDK to communicate with third-party ad networks, you need to include a mediation adapter for each network in your app. Each adapter must be integrated in the Android and iOS layer of your application.

Some third-party networks also ship as scoped npm packages under @react-native-google-mobile-ads/<network> (optional; install only what you mediate). See Migrating to v17.

To choose the adapters you want to install, see Integrate open source and versioned adapters (Android | iOS).

Some adapters constrain the compatible Google Mobile Ads SDK version. The adapter packages do not change that SDK pin. If you must override the package's supported default, follow Native SDK version overrides and test the app-owned combination.

Tip pins for each scoped adapter live in that package's packages/<network>/package.json under sdkVersions (android.googleMobileAdsMediation / ios.googleMobileAdsMediation). Prefer those pins (or the scoped npm package) over hard-coding older Expo expo-build-properties versions.

Yandex (@react-native-google-mobile-ads/yandex) is iOS-only. Its CocoaPods pin (YandexMobileAdsAdMobAdapters in packages/yandex/package.json sdkVersions) still requires Google-Mobile-Ads-SDK ~> 13.8.0, which does not admit core's iOS tip pin (13.10.0). See the yandex adapter package documentation for the conflict and options before enabling that network.

Android Next-Gen and mediation hosts

When the Android build selects GMA Next-Gen, the scoped adapter packages exclude transitive classic play-services-ads / play-services-ads-lite so only Next-Gen is on the classpath. AdMob-hosted mediation is supported. For a third-party mediation platform, check its compatibility before selecting Next-Gen; see Mediation and Google Ad Manager.

Android

  • Add the adapter's dependency to your app-level android/app/build.gradle file.

iOS

  • Add the adapter's pod to your ios/Podfile.

Verify your setup with ad inspector

To open the ad inspector from your React Native application, see Ad inspector.

Meta Audience Network (Facebook)

Install the scoped adapter package (@react-native-google-mobile-ads/facebook) rather than pinning GoogleMobileAdsMediationFacebook alone via expo-build-properties. The package pins the Google mediation adapter (and thus FBAudienceNetwork) and exposes Meta privacy hooks.

Call those hooks before mobileAds().initialize() when they apply:

ts
import mobileAds from 'react-native-google-mobile-ads';
import {
  setAdvertiserTrackingEnabled,
  setDataProcessingOptions,
} from '@react-native-google-mobile-ads/facebook';

// After App Tracking Transparency resolves (when you use ATT on iOS versions that still need it):
setAdvertiserTrackingEnabled(trackingGranted);
// Optional Limited Data Use:
// setDataProcessingOptions(['LDU']);

await mobileAds().initialize();
PlatformAdvertiser trackingData-processing options
iOSCalls FBAdSettings.setAdvertiserTrackingEnabled. On iOS 17+ with Audience Network 6.15.0+, Meta’s own header marks that setter deprecated and unused — the SDK reads ATTrackingManager.trackingAuthorizationStatus instead. Still call it on older iOS, or keep it for a single code path; it does not fix a process-start crash.FBAdSettings.setDataProcessingOptions
AndroidNo-op — Meta’s Android AdSettings has no advertiser-tracking setterAdSettings.setDataProcessingOptions

Do not put metaAdvertiserTrackingEnabled / metaDataProcessingOptions / metaAudienceNetworkEnabled on the core Expo plugin — those keys are not recognized. The core and @react-native-google-mobile-ads/facebook Expo plugins warn on unknown options. The facebook adapter plugin only merges skAdNetworkItems; advertiser tracking remains a runtime JS call because ATT status is not knowable at prebuild time.

iOS process-start crash when the Meta adapter is linked

Linking GoogleMobileAdsMediationFacebook pulls in Meta’s FBAudienceNetwork framework. That SDK can abort during its own early dispatch_once work on the main queue — before any ad request and before JavaScript runs. A reported signature is SIGABRT with an unrecognized selector involving a format string %s on NSString. That path is inside Meta’s binary, not in react-native-google-mobile-ads native modules (the JS setAdvertiserTrackingEnabled bridge cannot run early enough to prevent it).

If AppLovin / Unity mediation start fine and only Meta fails at launch:

  1. Confirm the AdMob / GAM iOS App ID is in Info.plist (GADApplicationIdentifier via the core Expo plugin). A missing AdMob App ID also crashes at start; that is unrelated to Meta and is already covered in Google AdMob.
  2. Set NSUserTrackingUsageDescription (core plugin userTrackingUsageDescription) when you use ATT.
  3. Prefer the scoped package tip pin in packages/facebook/package.json sdkVersions over an older Expo expo-build-properties pod pin.
  4. Retest on a non-beta iOS release. Beta OS builds have shown the same Meta launch abort with older adapter pins (for example mediation 6.17.1.0 on iOS 26 beta).

This library cannot patch Meta’s closed-source dispatch_once path. Escalate persistent launch aborts to Meta Audience Network / Google’s Meta mediation adapter with a full crash report.

See the facebook adapter package documentation for class names and pins.

Pangle (ByteDance)

Prefer the scoped mediation package (@react-native-google-mobile-ads/pangle) so Pangle participates in AdMob / GAM mediation through Google’s adapter. That package links GoogleMobileAdsMediationPangle / com.google.ads.mediation:pangle (tip pins in packages/pangle/package.json sdkVersions) and does not add JS load/show APIs — use core initialize(), fullscreen / native / banner surfaces, and adapter status as usual.

Lifecycle: destroy() already exists

Fullscreen (InterstitialAd, RewardedAd, RewardedInterstitialAd, AppOpenAd), native ads, multi-format handles, and preload pools expose idempotent destroy() (and hooks that own inventory call it for you). See Migrating to v17 — lifecycle. Call destroy() when you finish with an ad (or let hook / pool ownership rules do it). There is no separate destroy API for Pangle in this library: mediation adapters are not owned as separate JS ad objects.

iOS Auto Layout conflicts when hosting Google and Pangle video together

Reports of iOS Unable to simultaneously satisfy constraints on a UIButton with two different trailing constants against a UIImageView (for example -(5)-| and -(36)-|), often while loading Google and Pangle video creatives in the same process, originate inside third-party creative / SDK view hierarchies — not in this package’s React Native banner or fullscreen bridges (those do not build that UIButton/UIImageView constraint pair).

UIKit typically recovers by breaking one constraint; treat a symbolic UIViewAlertForUnsatisfiableConstraints breakpoint or console noise as an upstream layout warning unless you have a native crash stack that points at RNGoogleMobileAds* code.

If you also link the Pangle host SDK directly (for example CocoaPods Ads-Global plus a custom Pangle TurboModule) alongside react-native-google-mobile-ads, you are dual-hosting two video ad stacks. Prefer mediation via @react-native-google-mobile-ads/pangle instead of a second direct Pangle integration, keep core destroy() hygiene, and escalate persistent creative Auto Layout failures to Pangle / Google’s Pangle mediation adapter with a full Instruments / constraint dump.

See the pangle adapter package documentation for class names and pins.

Call Android / iOS code from React Native

A third-party mediation adapter might have specific Android or iOS APIs that aren't exposed to your React Native code. In these cases, you can create a custom "bridge" to expose that native functionality.

This involves writing native code in both the Android and iOS layer.

Android

Create a Module class to contain your native logic and a Package class to register that module with your application.

  1. Create the native module. This class contains the methods you want to call from JavaScript.

Example file: android/app/src/main/java/com/your-app-name/

The following example creates a Module class to use with the Google Mobile Ads mediation adapter for AppLovin:

text
package com.your-app-name

import android.util.Log
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.bridge.ReactContextBaseJavaModule
import com.facebook.react.bridge.ReactMethod
// Import the necessary third-party SDKs.
import com.applovin.sdk.AppLovinPrivacySettings

class GoogleMobileAdsMediationAppLovinModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext) {

  // The React layer interfaces with the value of this API.
  override fun getName() = "GoogleMobileAdsMediationAppLovin"

  // This exposes the method to the React layer.
  @ReactMethod
  fun setHasUserConsent(hasUserConsent: Boolean) {
    AppLovinPrivacySettings.setHasUserConsent(hasUserConsent)
  }
}
  1. Create the package

    This class registers your module so React Native can find it.

Example file: android/app/src/main/java/com/your-app-name/

text
package com.your-app-name

import com.facebook.react.ReactPackage
import com.facebook.react.bridge.NativeModule
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.uimanager.ViewManager
import java.util.Collections

class GoogleMobileAdsMediationAppLovinPackage : ReactPackage {
  override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
    return listOf(GoogleMobileAdsMediationAppLovinModule(reactContext))
  }

  override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager&lt;*, *>> {
    return Collections.emptyList()
  }
}
  1. Register the package

Add your new package in your MainApplication file:

text
override fun getPackages(): List<ReactPackage> =
  PackageList(this).packages.apply {
    // Add your custom package here.
    add(GoogleMobileAdsMediationAppLovinPackage())
}

iOS

Create a header (.h) and an implementation (.m) file. The following example creates an GoogleMobileAdsMediationAppLovin class:

Example file: ios/GoogleMobileAdsMediationAppLovin.h

text
#import <React/RCTBridgeModule.h>

@interface GoogleMobileAdsMediationAppLovin : NSObject <RCTBridgeModule>
@end

Example file: ios/GoogleMobileAdsMediationAppLovin.m

text
#import "GoogleMobileAdsMediationAppLovin.h"
#import <Foundation/Foundation.h>
// Import the necessary third-party SDKs.
#import <AppLovinSDK/AppLovinSDK.h>

@implementation GoogleMobileAdsMediationAppLovin

// The React layer interfaces with the class name, e.g. GoogleMobileAdsMediationAppLovin, by default.
RCT_EXPORT_MODULE();

// This exports the method to the React layer.
RCT_EXPORT_METHOD(setHasUserConsent:(BOOL)hasUserConsent)
{
  [ALPrivacySettings setHasUserConsent:hasUserConsent];
}

@end

Import native modules

In the JavaScript file where you want to call the native method, import NativeModules from the react-native library:

text
import { NativeModules } from 'react-native'

You can then access your module directly from the NativeModules object. The name you use here must exactly match the name exposed by your native code.

The following example uses the GoogleMobileAdsMediationAppLovin sample class:

text
const { GoogleMobileAdsMediationAppLovin } = NativeModules

Once you have the module object, you can work with your object just as you would in JavaScript.

text
GoogleMobileAdsMediationAppLovin.setHasUserConsent(true)