PremiumAds Google AdMob/AdManager Adapter V2 — Unity
Integrate PremiumAds as a mediation ad source in your Unity app using Google Mobile Ads Unity Plugin.
Supported formats: Banner, Interstitial, Rewarded, Rewarded Interstitial, Native, App Open
Prerequisites
- Unity 2022.3 LTS or newer (Unity 6 supported)
- Google Mobile Ads Unity Plugin (required)
- External Dependency Manager for Unity (EDM4U) — already included in Google Mobile Ads Unity Plugin
1. Install the PremiumAds Unity Package
- Download the latest
PremiumAdsGoogleAdapter.unitypackagefrom the Releases page. - In Unity: Assets → Import Package → Custom Package → select the downloaded
.unitypackage - Click Import to import all files.
After import, your project will contain:
Assets/PremiumAdsGoogleAdapter/
├── Editor/PremiumAdsDependencies.xml # EDM4U config
├── Runtime/PremiumAdsAdapter.cs # C# wrapper
└── Runtime/Plugins/iOS/ # iOS bridge
2. Resolve Native Dependencies
EDM4U will automatically resolve native dependencies on next build:
- Android:
net.premiumads.sdk:admob-adapter-v2(from PremiumAds JFrog Maven) - iOS:
PremiumAdsGoogleAdapter(from CocoaPods, requires Google Mobile Ads SDK 13.0+)
To force resolve immediately: Assets → External Dependency Manager → Android Resolver → Force Resolve
3. Configure AdMob Custom Event
In the AdMob console, configure a Custom Event for each ad unit you want to serve via PremiumAds:
| Platform | Field | Value |
|---|---|---|
| Android | Class Name | net.premiumads.sdk.adapter.PremiumAdsAdapter |
| iOS | Class Name | PremiumAdsAdapter |
| Both | Parameter | Your 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.
4. Load Ads
The adapter is invoked automatically by Google Mobile Ads Unity Plugin — no extra code needed. Use the standard Google Mobile Ads API to load ads:
using GoogleMobileAds.Api;
using UnityEngine;
public class AdsManager : MonoBehaviour
{
private BannerView _bannerView;
private InterstitialAd _interstitialAd;
private RewardedAd _rewardedAd;
private AppOpenAd _appOpenAd;
void Start()
{
MobileAds.Initialize(initStatus => { });
}
// Banner
public void LoadBanner()
{
_bannerView = new BannerView("ca-app-pub-xxxxx/xxxxx", AdSize.Banner, AdPosition.Bottom);
_bannerView.LoadAd(new AdRequest());
}
// Interstitial
public void LoadInterstitial()
{
InterstitialAd.Load("ca-app-pub-xxxxx/xxxxx", new AdRequest(), (ad, error) =>
{
if (error != null || ad == null) return;
_interstitialAd = ad;
ad.Show();
});
}
// Rewarded
public void LoadRewarded()
{
RewardedAd.Load("ca-app-pub-xxxxx/xxxxx", new AdRequest(), (ad, error) =>
{
if (error != null || ad == null) return;
_rewardedAd = ad;
ad.Show(reward => Debug.Log($"Earned {reward.Amount} {reward.Type}"));
});
}
// Rewarded Interstitial
public void LoadRewardedInterstitial()
{
RewardedInterstitialAd.Load("ca-app-pub-xxxxx/xxxxx", new AdRequest(), (ad, error) =>
{
if (error != null || ad == null) return;
ad.Show(reward => Debug.Log($"Earned {reward.Amount} {reward.Type}"));
});
}
// App Open
public void LoadAppOpen()
{
AppOpenAd.Load("ca-app-pub-xxxxx/xxxxx", new AdRequest(), (ad, error) =>
{
if (error != null || ad == null) return;
_appOpenAd = ad;
ad.Show();
});
}
}
5. Debug Logging (Optional)
Enable verbose debug logging from the PremiumAds adapter:
using PremiumAds;
void Start()
{
PremiumAdsAdapter.SetDebug(true);
MobileAds.Initialize(initStatus => { });
}
Filter logs:
- Android Logcat:
tag:PremiumAdsAdapter - iOS Xcode console:
[PremiumAdsAdapter]
Example output:
[PremiumAdsAdapter] Debug mode enabled | PremiumAds Adapter v1.0.8
[PremiumAdsAdapter] [Banner] Loading ad with unit: 1234567
[PremiumAdsAdapter] [Banner] Ad loaded successfully
[PremiumAdsAdapter] [Banner] Impression recorded
[PremiumAdsAdapter] [Banner] Click recorded
6. Build & Run
Android
- Unity: File → Build Settings → Android
- EDM4U will fetch the adapter AAR automatically during build
- Run on a real device or emulator
iOS
- Unity: File → Build Settings → iOS → Build
- Open the generated Xcode project workspace (
.xcworkspace) - CocoaPods will auto-install
PremiumAdsGoogleAdapterpod - Build and run on device
Sample Scene
A sample scene demonstrating all 6 ad formats is available at:
Assets/PremiumAdsGoogleAdapter/Samples~/AdMobExample/
Open AdMobSample.unity to see a complete working example.
Source Code & Releases
- Repository: https://github.com/premium-ads/googleads-adapter-v2-unity
- Releases: https://github.com/premium-ads/googleads-adapter-v2-unity/releases
Troubleshooting
Build fails with missing AAR: Run Assets → External Dependency Manager → Android Resolver → Force Resolve
iOS build fails with missing pod:
Open terminal in generated Xcode project folder and run pod install
Adapter not initialized: 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]