Skip to main content
Version: v2.0

PremiumAds Google AdMob Mediation Adapter

Integrate PremiumAds as a mediation ad source in your Google AdMob app.

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


Android

Prerequisites

  • Google Mobile Ads SDK 23.6.0+
  • minSdk 21+, compileSdk 34+

1. Add Repository & Dependency

settings.gradle.kts:

dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url = uri("https://repo.premiumads.net/artifactory/mobile-ads-sdk/") }
}
}

app/build.gradle.kts:

dependencies {
implementation("com.google.android.gms:play-services-ads:23.6.0")
implementation("net.premiumads.sdk:admob-adapter-v2:1.0.10")
}
Groovy (build.gradle)
// settings.gradle
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
repositories {
google()
mavenCentral()
maven { url "https://repo.premiumads.net/artifactory/mobile-ads-sdk/" }
}
}

// app/build.gradle
dependencies {
implementation 'com.google.android.gms:play-services-ads:25.1.0'
implementation 'net.premiumads.sdk:admob-adapter-v2:1.0.10'
}

2. Configure AdMob Custom Event

In the AdMob console, open your Mediation Group and add a Custom Event as a Waterfall ad source. Then map each AdMob ad unit (banner, interstitial, rewarded, native, or app open) to a PremiumAds adapter:

AdMob mediation custom event mapping setup

Fields:

FieldValue
Mapping nameAny label that helps you identify the source (e.g. PremiumAds-Gen2)
Network eCPMThe eCPM floor from PremiumAds for this ad unit (reference only)
Class Namenet.premiumads.sdk.adapter.PremiumAdsAdapter
ParameterYour PremiumAds ad unit ID (e.g. 198810002)
tip

All ad formats share the same PremiumAdsAdapter class name — the adapter auto-detects the format at runtime from the AdMob ad unit type.

3. Load Ads

Use standard Google Mobile Ads SDK APIs — no PremiumAds-specific code needed:

// Initialize
MobileAds.initialize(this) { }

// Banner
val adView = AdView(this)
adView.adUnitId = "ca-app-pub-xxxxx/xxxxx"
adView.setAdSize(AdSize.BANNER)
adView.loadAd(AdRequest.Builder().build())

// Interstitial
InterstitialAd.load(this, "ca-app-pub-xxxxx/xxxxx",
AdRequest.Builder().build(),
object : InterstitialAdLoadCallback() {
override fun onAdLoaded(ad: InterstitialAd) {
ad.show(this@MainActivity)
}
})

// Rewarded
RewardedAd.load(this, "ca-app-pub-xxxxx/xxxxx",
AdRequest.Builder().build(),
object : RewardedAdLoadCallback() {
override fun onAdLoaded(ad: RewardedAd) {
ad.show(this@MainActivity) { reward ->
Log.d("Ads", "Earned: ${reward.amount} ${reward.type}")
}
}
})

// Native
val adLoader = AdLoader.Builder(this, "ca-app-pub-xxxxx/xxxxx")
.forNativeAd { ad -> /* display in NativeAdView */ }
.build()
adLoader.loadAd(AdRequest.Builder().build())

// App Open
AppOpenAd.load(this, "ca-app-pub-xxxxx/xxxxx",
AdRequest.Builder().build(),
object : AppOpenAd.AppOpenAdLoadCallback() {
override fun onAdLoaded(ad: AppOpenAd) {
ad.show(this@MainActivity)
}
})

4. GDPR Compliance

The adapter automatically reads IAB TCF v2.0 consent from SharedPreferences. If you use Google's UMP SDK, no extra code is needed.

5. Debug Logging

PremiumAdsAdapter.setDebug(true)

Filter Logcat with tag PremiumAdsAdapter:

D/PremiumAdsAdapter: [Banner] Loading ad with unit: 6677029
D/PremiumAdsAdapter: [Banner] Ad loaded successfully
D/PremiumAdsAdapter: [Banner] Impression recorded

6. ProGuard

No additional ProGuard rules needed — the adapter includes its own consumer rules.

7. Verify

Use Ad Inspector to confirm the adapter is recognized and serving ads.


iOS

Prerequisites

  • Google Mobile Ads SDK 11.0+ (supports up to v13)
  • Xcode 15+, iOS 13.0+

CocoaPods (Preferred)

pod 'PremiumAdsGoogleAdapter'

Swift Package Manager

  1. File → Add Packages
  2. Enter: https://github.com/premium-ads/adapter-ios-spm-v2
  3. Set Dependency Rule to "Up to Next Major Version" from 1.0.4

Configure AdMob Custom Event

FieldValue
Class NamePremiumAdsAdapter
ParameterYour PremiumAds ad unit ID

Load Ads

Use standard Google Mobile Ads SDK APIs:

import GoogleMobileAds

// Initialize
MobileAds.shared.start { status in }

// Banner
let bannerView = BannerView(adSize: AdSizeBanner)
bannerView.adUnitID = "ca-app-pub-xxxxx/xxxxx"
bannerView.rootViewController = self
bannerView.load(Request())

// Interstitial
InterstitialAd.load(with: "ca-app-pub-xxxxx/xxxxx", request: Request()) { ad, error in
ad?.present(from: self)
}

// Rewarded
RewardedAd.load(with: "ca-app-pub-xxxxx/xxxxx", request: Request()) { ad, error in
ad?.present(from: self) {
let reward = ad?.adReward
print("Earned: \(reward?.amount ?? 0) \(reward?.type ?? "")")
}
}

// App Open
AppOpenAd.load(with: "ca-app-pub-xxxxx/xxxxx", request: Request()) { ad, error in
ad?.present(from: self)
}

GDPR

The adapter reads IAB TCF v2.0 consent from UserDefaults automatically.

Debug Logging

PremiumAdsAdapter.setDebug(true)

Logs appear in Xcode console with [PremiumAdsAdapter] prefix.


Migration from SDK v1

Old (v1)New (v2)
Android artifactnet.premiumads.sdk:admob-adapter:2.2.7net.premiumads.sdk:admob-adapter-v2:1.0.10
Android classnet.premiumads.sdk.admob.PremiumBannerAd etc.net.premiumads.sdk.adapter.PremiumAdsAdapter (all formats)
iOS podPremiumAdsAdapterPremiumAdsGoogleAdapter
iOS classGADMediationAdapterPremiumAdsPremiumAdsAdapter
DebugPremiumAdSDK.setDebug(true)PremiumAdsAdapter.setDebug(true)
GDPRManual npa bundle extrasAutomatic (TCF v2.0)
ProGuardManual rules requiredBuilt-in
minSdk1921

Steps:

  1. Replace dependency in build.gradle
  2. Update AdMob Custom Event class name (single class for all formats)
  3. Remove old ProGuard rules for net.premiumads.sdk.admob.**
  4. Remove manual GDPR npa bundle code
  5. Replace PremiumAdSDK.setDebug(true)PremiumAdsAdapter.setDebug(true)

Support

Contact your PremiumAds account manager or email [email protected]