Skip to main content
Version: v2.0

Google AdMob/AdManager Adapter V2 — React Native

Integrate PremiumAds as a mediation ad source in your React Native app using the react-native-google-mobile-ads library.

Supported formats: Banner, Interstitial, Rewarded, Rewarded Interstitial, Native, App Open

Prerequisites

1. Install the Packages

npm install react-native-google-mobile-ads @premiumads/react-native-admob-adapter

Or with Yarn:

yarn add react-native-google-mobile-ads @premiumads/react-native-admob-adapter

npm: https://www.npmjs.com/package/@premiumads/react-native-admob-adapter

2. Configure AdMob App IDs

Add your Google AdMob App IDs to app.json at the project root (used by react-native-google-mobile-ads autolinking):

{
"react-native-google-mobile-ads": {
"android_app_id": "ca-app-pub-xxxxxxxxxxxxxxxx~xxxxxxxxxx",
"ios_app_id": "ca-app-pub-xxxxxxxxxxxxxxxx~xxxxxxxxxx"
}
}

3. Native Dependencies (Automatic)

The wrapper package pulls the native binaries in automatically via React Native autolinking — no manual Gradle or Podfile edits required:

  • Android: net.premiumads.sdk:admob-adapter-v2 from the PremiumAds JFrog Maven repository (injected by the wrapper's build.gradle)
  • iOS: PremiumAdsGoogleAdapter pod from CocoaPods trunk (pulled in via the wrapper's podspec dependency)

After installing the npm package, finish the native setup:

# iOS — install pods
cd ios && pod install && cd ..

# Android — no extra step, just rebuild

4. Configure AdMob Custom Event

In the AdMob console, configure a Custom Event for each mediated ad unit:

PlatformFieldValue
AndroidClass Namenet.premiumads.sdk.adapter.PremiumAdsAdapter
iOSClass NamePremiumAdsAdapter
BothParameterYour PremiumAds ad unit ID (e.g. 1234567)

The same class name works for all ad formats (Banner, Interstitial, Rewarded, Rewarded Interstitial, Native, App Open). The adapter auto-detects the format from the AdMob mediation request.

5. Initialize and Load Ads

The adapter is invoked automatically by Google Mobile Ads SDK — you only need to use the standard react-native-google-mobile-ads API.

import React, {useEffect} from 'react';
import mobileAds from 'react-native-google-mobile-ads';
import {setDebug as setPremiumAdsDebug} from '@premiumads/react-native-admob-adapter';

export default function App() {
useEffect(() => {
// Optional: enable PremiumAds adapter debug logging (dev only)
setPremiumAdsDebug(__DEV__);

mobileAds()
.initialize()
.then(adapterStatuses => {
console.log('AdMob mediation adapters:', adapterStatuses);
});
}, []);

// …your app UI
}
import {BannerAd, BannerAdSize} from 'react-native-google-mobile-ads';

<BannerAd
unitId="ca-app-pub-xxxxxxxxxxxxxxxx/xxxxxxxxxx"
size={BannerAdSize.ANCHORED_ADAPTIVE_BANNER}
onAdLoaded={() => console.log('Banner loaded')}
onAdFailedToLoad={err => console.log('Banner failed:', err.message)}
/>

Interstitial

import {InterstitialAd, AdEventType} from 'react-native-google-mobile-ads';

const interstitial = InterstitialAd.createForAdRequest(
'ca-app-pub-xxxxxxxxxxxxxxxx/xxxxxxxxxx',
);

interstitial.addAdEventListener(AdEventType.LOADED, () => interstitial.show());
interstitial.addAdEventListener(AdEventType.ERROR, err => console.log(err));
interstitial.load();

Rewarded

import {RewardedAd, RewardedAdEventType, AdEventType} from 'react-native-google-mobile-ads';

const rewarded = RewardedAd.createForAdRequest(
'ca-app-pub-xxxxxxxxxxxxxxxx/xxxxxxxxxx',
);

rewarded.addAdEventListener(RewardedAdEventType.LOADED, () => rewarded.show());
rewarded.addAdEventListener(RewardedAdEventType.EARNED_REWARD, reward => {
console.log(`Earned ${reward.amount} ${reward.type}`);
});
rewarded.addAdEventListener(AdEventType.ERROR, err => console.log(err));
rewarded.load();

Rewarded Interstitial

import {RewardedInterstitialAd, RewardedAdEventType, AdEventType} from 'react-native-google-mobile-ads';

const ri = RewardedInterstitialAd.createForAdRequest(
'ca-app-pub-xxxxxxxxxxxxxxxx/xxxxxxxxxx',
);
ri.addAdEventListener(RewardedAdEventType.LOADED, () => ri.show());
ri.addAdEventListener(RewardedAdEventType.EARNED_REWARD, r => console.log(r));
ri.load();

App Open

import {AppOpenAd, AdEventType} from 'react-native-google-mobile-ads';

const appOpen = AppOpenAd.createForAdRequest(
'ca-app-pub-xxxxxxxxxxxxxxxx/xxxxxxxxxx',
);
appOpen.addAdEventListener(AdEventType.LOADED, () => appOpen.show());
appOpen.load();

Native Ads

Follow the react-native-google-mobile-ads native ad guide. The PremiumAds adapter fills native ad slots transparently via AdMob mediation.

6. Debug Logging (Optional)

Enable verbose debug logging from the PremiumAds adapter:

import {setDebug} from '@premiumads/react-native-admob-adapter';

setDebug(true);

Filter logs:

  • Android Logcat: adb logcat -s PremiumAdsAdapter:V
  • iOS Xcode console / Simulator stdout: [PremiumAdsAdapter]

Example output:

D PremiumAdsAdapter: Debug mode enabled | PremiumAds Adapter v1.0.8
D PremiumAdsAdapter: [Interstitial] Loading ad with unit: 1234567
D PremiumAdsAdapter: [Interstitial] Ad loaded successfully
D PremiumAdsAdapter: [Interstitial] Showing ad
D PremiumAdsAdapter: [Interstitial] Impression recorded
D PremiumAdsAdapter: [Interstitial] Click recorded

7. Build & Run

Android

npx react-native run-android

iOS

cd ios && pod install && cd ..
npx react-native run-ios

Example App

A complete example app demonstrating all 6 ad formats lives in the example/ folder of this repository.

Source Code

Versioning

This JS package is versioned independently from the underlying native adapters. The current release pins:

  • Android: net.premiumads.sdk:admob-adapter-v2:1.0.9
  • iOS: PremiumAdsGoogleAdapter (1.0.6)

Troubleshooting

Build fails on iOS with missing PremiumAdsGoogleAdapter:

cd ios && pod install --repo-update

Build fails on Android with Could not find net.premiumads.sdk:admob-adapter-v2: The wrapper injects the PremiumAds Maven repo automatically. If you use a restricted Gradle setup (e.g. FAIL_ON_PROJECT_REPOS), add it manually:

// android/build.gradle
allprojects {
repositories {
maven { url 'https://repo.premiumads.net/artifactory/mobile-ads-sdk/' }
}
}

Unable to resolve module @premiumads/react-native-admob-adapter: Restart Metro with a cache reset:

npx react-native start --reset-cache

Adapter not initialized / Failed to create Adapter: Verify the custom event class name in AdMob console matches exactly:

  • Android: net.premiumads.sdk.adapter.PremiumAdsAdapter
  • iOS: PremiumAdsAdapter

Documentation

Support

Contact your PremiumAds account manager or email [email protected]