PremiumAds Google Adapter — Android Next-Gen
Dedicated adapter for publishers using Google's next-generation Mobile Ads SDK (com.google.android.libraries.ads.mobile.sdk:ads-mobile-sdk). This is a separate artifact from the legacy admob-adapter-v2 and is required when you're integrating the NextGen SDK.
Supported formats: Banner, Interstitial, Rewarded, Rewarded Interstitial, App Open
Native ads are NOT supported in the NextGen adapter due to an architectural gap in NextGen SDK 1.0.0 (the legacy mediation click bridge is not wired to
NativeAdView.onInterceptTouchEvent). Publishers who need native ads should continue to use the legacyadmob-adapter-v2— which supports native ads via the standard AdMob SDK.
Prerequisites
| Requirement | Version |
|---|---|
| Google NextGen Mobile Ads SDK | 1.0.0+ |
Android minSdk | 24 |
| Kotlin / JVM target | 17 |
If you're still on the classic play-services-ads SDK, use the standard PremiumAds Android adapter instead.
1. Add the Dependency
settings.gradle.kts
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven { url = uri("https://repo.premiumads.net/artifactory/mobile-ads-sdk/") }
}
}
app/build.gradle.kts
dependencies {
implementation("com.google.android.libraries.ads.mobile.sdk:ads-mobile-sdk:1.0.0")
implementation("net.premiumads.sdk:admob-adapter-nextgen:1.0.0")
}
2. Configure the AdMob Custom Event
In the AdMob console, add a Custom Event for each ad unit you want served via PremiumAds:
| Field | Value |
|---|---|
| Class Name | net.premiumads.sdk.adapter.nextgen.PremiumAdsNextGenAdapter |
| Parameter | Your PremiumAds ad unit ID (e.g. 1234567) |
The same class name works for all supported formats — the adapter auto-detects the requested format from the mediation configuration.
3. Initialize the SDK
Important: NextGen SDK requires initialization to run on a background thread.
import com.google.android.libraries.ads.mobile.sdk.MobileAds
import com.google.android.libraries.ads.mobile.sdk.initialization.InitializationConfig
import kotlin.concurrent.thread
class MyApp : Application() {
override fun onCreate() {
super.onCreate()
thread {
MobileAds.initialize(this, InitializationConfig.Builder().build())
}
}
}
4. Load Ads
Use the standard NextGen SDK APIs — the mediation adapter is invoked automatically when AdMob routes a request to PremiumAds. No adapter-specific code is required.
Banner
import com.google.android.libraries.ads.mobile.sdk.banner.AdView
import com.google.android.libraries.ads.mobile.sdk.banner.AdSize
import com.google.android.libraries.ads.mobile.sdk.banner.BannerAd
import com.google.android.libraries.ads.mobile.sdk.banner.BannerAdRequest
import com.google.android.libraries.ads.mobile.sdk.common.AdLoadCallback
val adView = AdView(this).apply {
adSize = AdSize.BANNER
adUnitId = "ca-app-pub-xxxxx/xxxxx"
}
bannerContainer.addView(adView)
val request = BannerAdRequest.Builder(adView.adUnitId).build()
BannerAd.load(adView, request, object : AdLoadCallback<BannerAd> {
override fun onAdLoaded(ad: BannerAd) { /* shown automatically */ }
override fun onAdFailedToLoad(error: LoadAdError) { /* ... */ }
})
Interstitial
import com.google.android.libraries.ads.mobile.sdk.interstitial.InterstitialAd
import com.google.android.libraries.ads.mobile.sdk.interstitial.InterstitialAdEventCallback
val request = AdRequest.Builder("ca-app-pub-xxxxx/xxxxx").build()
InterstitialAd.load(request, object : AdLoadCallback<InterstitialAd> {
override fun onAdLoaded(ad: InterstitialAd) {
ad.adEventCallback = object : InterstitialAdEventCallback {
override fun onAdShowedFullScreenContent() { /* ... */ }
override fun onAdDismissedFullScreenContent() { /* ... */ }
override fun onAdImpression() { /* ... */ }
override fun onAdClicked() { /* ... */ }
}
ad.show(activity)
}
override fun onAdFailedToLoad(error: LoadAdError) { /* ... */ }
})
Rewarded
import com.google.android.libraries.ads.mobile.sdk.rewarded.RewardedAd
import com.google.android.libraries.ads.mobile.sdk.rewarded.OnUserEarnedRewardListener
val request = AdRequest.Builder("ca-app-pub-xxxxx/xxxxx").build()
RewardedAd.load(request, object : AdLoadCallback<RewardedAd> {
override fun onAdLoaded(ad: RewardedAd) {
ad.show(activity, OnUserEarnedRewardListener { reward ->
// reward.amount, reward.type
})
}
override fun onAdFailedToLoad(error: LoadAdError) { /* ... */ }
})
Rewarded Interstitial
import com.google.android.libraries.ads.mobile.sdk.rewardedinterstitial.RewardedInterstitialAd
val request = AdRequest.Builder("ca-app-pub-xxxxx/xxxxx").build()
RewardedInterstitialAd.load(request, object : AdLoadCallback<RewardedInterstitialAd> {
override fun onAdLoaded(ad: RewardedInterstitialAd) {
ad.show(activity, OnUserEarnedRewardListener { reward -> /* ... */ })
}
override fun onAdFailedToLoad(error: LoadAdError) { /* ... */ }
})
App Open
import com.google.android.libraries.ads.mobile.sdk.appopen.AppOpenAd
val request = AdRequest.Builder("ca-app-pub-xxxxx/xxxxx").build()
AppOpenAd.load(request, object : AdLoadCallback<AppOpenAd> {
override fun onAdLoaded(ad: AppOpenAd) {
ad.show(activity)
}
override fun onAdFailedToLoad(error: LoadAdError) { /* ... */ }
})
Native — Not Supported
Native ads via mediation are not supported on the NextGen adapter. If an AdMob waterfall routes a native request to PremiumAds, the adapter returns a clear load error instructing the publisher to fall back to the legacy admob-adapter-v2. See the limitation note below for details.
5. Debug Logging
Enable verbose adapter logging to trace loads, impressions, and clicks:
import net.premiumads.sdk.adapter.nextgen.PremiumAdsNextGenAdapter
PremiumAdsNextGenAdapter.setDebug(true)
Filter logs:
adb logcat -s PremiumAdsNextGenAdapter:V
Example output:
PremiumAdsNextGenAdapter: Debug mode enabled | PremiumAds Adapter v1.0.0
PremiumAdsNextGenAdapter: [Banner] Loading ad with unit: 1234567
PremiumAdsNextGenAdapter: [Banner] Ad loaded successfully
PremiumAdsNextGenAdapter: Cache HIT for adunit: 1234567
PremiumAdsNextGenAdapter: [Interstitial] Ad opened
PremiumAdsNextGenAdapter: [Interstitial] Impression recorded
PremiumAdsNextGenAdapter: [Interstitial] Ad closed
6. GDPR / TCF v2.0
IAB TCF v2.0 consent is read automatically from SharedPreferences by the adapter (standard AndroidX Preference storage). If you integrate Google's UMP SDK (or any TCF-compliant CMP), no additional adapter code is required.
Native Ads Limitation
NextGen SDK 1.0.0 does not provide a click bridge between the new com.google.android.libraries.ads.mobile.sdk.nativead.NativeAdView and the legacy UnifiedNativeAdMapper that mediation adapters implement. As a result, tapping on a mediated native ad never triggers the landing page. This is an SDK-level limitation, not an adapter bug — the limitation will be lifted when Google ships a proper NextGen-native mediation API.
Workaround: Continue to use the legacy PremiumAds Android adapter (net.premiumads.sdk:admob-adapter-v2) on AdMob native units. You can mix both adapters in the same app: use admob-adapter-nextgen for Banner/Interstitial/Rewarded/RewardedInterstitial/AppOpen, and admob-adapter-v2 for Native.
ProGuard
The adapter ships its own consumer ProGuard rules — no manual configuration needed.
Source & Releases
- Repository: https://github.com/premium-ads/google-mediation-adapter-nextgen
- Maven coordinates:
net.premiumads.sdk:admob-adapter-nextgen:1.0.0 - JFrog Maven: https://repo.premiumads.net/artifactory/mobile-ads-sdk/
Troubleshooting
Adapter class not found in AdMob log:
Verify the class name in the AdMob custom event is exactly net.premiumads.sdk.adapter.nextgen.PremiumAdsNextGenAdapter — note the .nextgen. package segment which distinguishes it from the legacy adapter class.
Ads never load:
- Ensure
MobileAds.initialize(...)has been called on a background thread before requesting an ad. - Double-check the PremiumAds ad unit ID set in the custom event parameter.
- Enable debug logs (
PremiumAdsNextGenAdapter.setDebug(true)) and filteradb logcat -s PremiumAdsNextGenAdapter:Vfor the load path.
Native ad shown but not clickable:
Native is not supported on this adapter — see Native Ads Limitation. Switch that ad unit's mediation to the legacy admob-adapter-v2.
Documentation
Support
Contact your PremiumAds account manager or email [email protected].