Skip to main content
Version: v2.0

PremiumAds Google Ad Manager Mediation Adapter

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

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

The same adapter SDK works for both AdMob and Ad Manager. The integration steps below are specific to Google Ad Manager.


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.9")
}
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:23.6.0'
implementation 'net.premiumads.sdk:admob-adapter-v2:1.0.9'
}

2. Configure Ad Manager Custom Event

In the Ad Manager console, create a Yield Group with a custom event:

FieldValue
Class Namenet.premiumads.sdk.adapter.PremiumAdsAdapter
ParameterYour PremiumAds ad unit ID

All ad formats use the same class name. The adapter auto-detects the format.

3. Load Ads

Use Google Ad Manager SDK APIs with AdManagerAdRequest:

import com.google.android.gms.ads.admanager.AdManagerAdRequest
import com.google.android.gms.ads.admanager.AdManagerAdView

// Initialize
MobileAds.initialize(this) { }

// Banner (Ad Manager)
val adView = AdManagerAdView(this)
adView.adUnitId = "/your-network-id/ad-unit"
adView.setAdSize(AdSize.BANNER)
adView.loadAd(AdManagerAdRequest.Builder().build())

// Interstitial
InterstitialAd.load(this, "/your-network-id/ad-unit",
AdManagerAdRequest.Builder().build(),
object : InterstitialAdLoadCallback() {
override fun onAdLoaded(ad: InterstitialAd) {
ad.show(this@MainActivity)
}
})

// Rewarded
RewardedAd.load(this, "/your-network-id/ad-unit",
AdManagerAdRequest.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, "/your-network-id/ad-unit")
.forNativeAd { ad -> /* display in NativeAdView */ }
.build()
adLoader.loadAd(AdManagerAdRequest.Builder().build())

// App Open
AppOpenAd.load(this, "/your-network-id/ad-unit",
AdManagerAdRequest.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.


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 Ad Manager Custom Event

FieldValue
Class NamePremiumAdsAdapter
ParameterYour PremiumAds ad unit ID

Load Ads

Use Google Ad Manager SDK APIs with GAMRequest:

import GoogleMobileAds

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

// Banner (Ad Manager)
let bannerView = GAMBannerView(adSize: AdSizeBanner)
bannerView.adUnitID = "/your-network-id/ad-unit"
bannerView.rootViewController = self
bannerView.load(GAMRequest())

// Interstitial
InterstitialAd.load(with: "/your-network-id/ad-unit", request: GAMRequest()) { ad, error in
ad?.present(from: self)
}

// Rewarded
RewardedAd.load(with: "/your-network-id/ad-unit", request: GAMRequest()) { ad, error in
ad?.present(from: self) {
let reward = ad?.adReward
print("Earned: \(reward?.amount ?? 0) \(reward?.type ?? "")")
}
}

// App Open
AppOpenAd.load(with: "/your-network-id/ad-unit", request: GAMRequest()) { 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.


Support

Contact your PremiumAds account manager or email [email protected]