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 22.2.0+ (23.6.0+ recommended; 22.x support requires adapter 1.0.11+)
- Google Mobile Ads SDK 25.5.0+ requires your app to build with Kotlin 2.3+ (the SDK ships Kotlin 2.3 metadata)
minSdk21+,compileSdk34+
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.12")
}
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.12'
}
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, rewarded interstitial, native, or app open) to a PremiumAds adapter:

Fields:
| Field | Value |
|---|---|
| Mapping name | Any label that helps you identify the source (e.g. PremiumAds-Gen2) |
| Network eCPM | The eCPM floor from PremiumAds for this ad unit (reference only) |
| Class Name | net.premiumads.sdk.adapter.PremiumAdsAdapter |
| Parameter | Your PremiumAds ad unit ID (e.g. 198810002) |
All ad formats share the same PremiumAdsAdapter class name — the adapter auto-detects the format at runtime from the AdMob ad unit type. Rewarded Interstitial needs no extra setup: create the AdMob ad unit with the Rewarded interstitial format and map it exactly like a rewarded unit.
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}")
}
}
})
// Rewarded Interstitial
RewardedInterstitialAd.load(this, "ca-app-pub-xxxxx/xxxxx",
AdRequest.Builder().build(),
object : RewardedInterstitialAdLoadCallback() {
override fun onAdLoaded(ad: RewardedInterstitialAd) {
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
- File → Add Packages
- Enter:
https://github.com/premium-ads/adapter-ios-spm-v2 - Set Dependency Rule to "Up to Next Major Version" from
1.0.4
Configure AdMob Custom Event
| Field | Value |
|---|---|
| Class Name | PremiumAdsAdapter |
| Parameter | Your 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 ?? "")")
}
}
// Rewarded Interstitial
RewardedInterstitialAd.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 ?? "")")
}
}
// Native
let adLoader = AdLoader(adUnitID: "ca-app-pub-xxxxx/xxxxx",
rootViewController: self, adTypes: [.native], options: nil)
adLoader.delegate = self // NativeAdLoaderDelegate: render the NativeAd in a NativeAdView
adLoader.load(Request())
// 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.
Error Codes & Troubleshooting
Reading a failed load
When the PremiumAds custom event does not serve, Google's SDK records the reason in the ad's ResponseInfo, under the adapter response whose credentials show:
class_name:net.premiumads.sdk.adapter.PremiumAdsAdapter(Android) orPremiumAdsAdapter(iOS)label: your mapping nameparameter: your PremiumAds ad unit ID
Google may report the custom event's failure as No fill (code 3 on Android) and put the adapter's own error under Cause. Always read the innermost error.
Adapter error codes
| Code | Platform and domain | Message | Meaning |
|---|---|---|---|
| 101 | Android net.premiumads.sdk.adapteriOS net.premiumads.adapter | Android: Failed to fetch config for adunit: <id>iOS: Failed to fetch config | The adapter could not get the configuration for the ad unit ID in the custom event Parameter, so no ad was requested. It does not mean the ad unit is missing on our side. See Fixing error 101. |
| 102 | Android net.premiumads.sdk.adapter | Varies | Adapter 1.0.12+: an unexpected error inside the adapter, or a full-screen ad shown without an Activity (Context is not an Activity).Adapter 1.0.11 and older: also every ad load failure returned by Google, including no fill, carrying Google's message. |
Any other code comes from Google's SDK and is passed through unchanged by Android adapter 1.0.12+ and by every iOS version: domain com.google.android.gms.ads (no fill = 3) on Android and com.google.admob (no fill = 1) on iOS. A no fill means the PremiumAds demand had no ad for that request, which is normal.
To see which Android adapter version your build uses, run ./gradlew app:dependencies | grep admob-adapter-v2.
Fixing error 101
Turn on debug logging (PremiumAdsAdapter.setDebug(true)), reproduce the failed load, and look for the line that starts with API error (Android, Logcat tag PremiumAdsAdapter) or [API] Error / [API] Failed to parse JSON (iOS, Xcode console):
D/PremiumAdsAdapter: API error (403): Signature expired
D/PremiumAdsAdapter: Failed to get config for adunit: 198810006
D/PremiumAdsAdapter: [Native] No config found for adunit: 198810006
| Log shows | Cause | Fix |
|---|---|---|
Ad unit not found or inactive | The Parameter does not match an active PremiumAds ad unit: a typo, an extra space or quote, or a unit that is not active yet. | Copy the ID exactly as provided. Ask your PremiumAds account manager if the unit should be active. |
Signature expired | The device clock is more than 5 minutes off. Common on test devices and emulators with a manually set date. | Turn on automatic date & time on the device. |
Any other API error / [API] Error line, or [API] Failed to parse JSON, such as Unable to resolve host, a timeout or a response that is not JSON | The device cannot reach admob-mediation.premiumtag.net: no connection, a VPN, an ad-blocking DNS, a proxy or a firewall. | Retry on another network, or allowlist the domain. |
No API error line, only the last two lines | Android 1.0.12+ / iOS 1.0.10+: the configuration service did not answer within 3 seconds on the first request. The adapter keeps fetching in the background, so the next request uses the result. | Retry. If it repeats, check the network as above. |
Once a configuration has been fetched, the adapter keeps it on the device and refreshes it in the background (Android 1.0.12+, iOS 1.0.10+), so a temporary network problem later does not cause error 101.
Android adapter 1.0.11 and older do not log the server's message, only API error: … with the connection error. With those versions, check the device clock and the network first.
If you still see error 101, send the debug log and the ad unit ID to your PremiumAds account manager.
Migration from SDK v1
| Old (v1) | New (v2) | |
|---|---|---|
| Android artifact | net.premiumads.sdk:admob-adapter:2.2.7 | net.premiumads.sdk:admob-adapter-v2:1.0.12 |
| Android class | net.premiumads.sdk.admob.PremiumBannerAd etc. | net.premiumads.sdk.adapter.PremiumAdsAdapter (all formats) |
| iOS pod | PremiumAdsAdapter | PremiumAdsGoogleAdapter |
| iOS class | GADMediationAdapterPremiumAds | PremiumAdsAdapter |
| Debug | PremiumAdSDK.setDebug(true) | PremiumAdsAdapter.setDebug(true) |
| GDPR | Manual npa bundle extras | Automatic (TCF v2.0) |
| ProGuard | Manual rules required | Built-in |
| minSdk | 19 | 21 |
Steps:
- Replace dependency in
build.gradle - Update AdMob Custom Event class name (single class for all formats)
- Remove old ProGuard rules for
net.premiumads.sdk.admob.** - Remove manual GDPR
npabundle code - Replace
PremiumAdSDK.setDebug(true)→PremiumAdsAdapter.setDebug(true)
Support
Contact your PremiumAds account manager or email [email protected]