Skip to main content
Version: v2.0

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

1. Install the PremiumAds Unity Package

  1. Download the latest PremiumAdsGoogleAdapter.unitypackage from the Releases page.
  2. In Unity: Assets → Import Package → Custom Package → select the downloaded .unitypackage
  3. 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:

PlatformFieldValue
AndroidClass Namenet.premiumads.sdk.adapter.PremiumAdsAdapter
iOSClass NamePremiumAdsAdapter
BothParameterYour 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

  1. Unity: File → Build Settings → Android
  2. EDM4U will fetch the adapter AAR automatically during build
  3. Run on a real device or emulator

iOS

  1. Unity: File → Build Settings → iOS → Build
  2. Open the generated Xcode project workspace (.xcworkspace)
  3. CocoaPods will auto-install PremiumAdsGoogleAdapter pod
  4. 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

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]