MZikmund.Uno.AdMob
1.0.0-beta.21
dotnet add package MZikmund.Uno.AdMob --version 1.0.0-beta.21
NuGet\Install-Package MZikmund.Uno.AdMob -Version 1.0.0-beta.21
<PackageReference Include="MZikmund.Uno.AdMob" Version="1.0.0-beta.21" />
<PackageVersion Include="MZikmund.Uno.AdMob" Version="1.0.0-beta.21" />
<PackageReference Include="MZikmund.Uno.AdMob" />
paket add MZikmund.Uno.AdMob --version 1.0.0-beta.21
#r "nuget: MZikmund.Uno.AdMob, 1.0.0-beta.21"
#:package MZikmund.Uno.AdMob@1.0.0-beta.21
#addin nuget:?package=MZikmund.Uno.AdMob&version=1.0.0-beta.21&prerelease
#tool nuget:?package=MZikmund.Uno.AdMob&version=1.0.0-beta.21&prerelease
Uno.AdMob
Google AdMob ads for Uno Platform apps on Android and iOS: banner, interstitial, rewarded, rewarded interstitial and app open ads, plus GDPR consent with Google's User Messaging Platform (UMP).
This library is a port of Plugin.AdMob by Marius Bughiu, who did the hard part. The API mirrors his on purpose, so his docs and issue tracker are useful here too. Thank you, Marius!
dotnet add package MZikmund.Uno.AdMob
Platform Support
| Platform | Banner | Interstitial | Rewarded | Rewarded interstitial | App open | Consent (UMP) |
|---|---|---|---|---|---|---|
| Android (API 24+) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| iOS (15.0+) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Windows / desktop / WebAssembly | compiles, no ads | compiles, no ads | compiles, no ads | compiles, no ads | compiles, no ads | compiles, no ads |
The package targets net10.0-android, net10.0-ios, net10.0-windows10.0.19041 and net10.0, and is built on Uno Platform 7.0 (Uno.Sdk).
Not yet supported: native ads support and WebAssembly/AdSense (planned v2).
Setup
1. Platform configuration
Android: in Platforms/Android/AndroidManifest.xml, add the AdMob app ID and the permissions:
<manifest ...>
<application ...>
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-3940256099942544~3347511713" />
</application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
The ID above is Google's sample ID. Replace it with yours when you go live. The minimum Android version must be 24.
iOS: in Platforms/iOS/Info.plist, add your app ID, GADIsAdManagerApp and the SKAdNetworkItems from Google's quick start:
<key>GADApplicationIdentifier</key>
<string>ca-app-pub-3940256099942544~1458002511</string>
<key>GADIsAdManagerApp</key>
<true/>
The minimum iOS version must be 15.0. See the Setup guide for the full list.
2. Register and initialize
Register the services, then hand the built service provider to AdMobPlatform:
using Microsoft.Extensions.DependencyInjection;
using Uno.AdMob;
using Uno.AdMob.Configuration;
// In your host configuration
services.AddAdMob();
AdConfig.UseTestAdUnitIds = true; // Google's test ads, safe to tap
// After building the host, on the UI thread
AdMobPlatform.Initialize(Host.Services);
Initialize throws if AddAdMob() was not called on that provider. It doesn't have to run before your first page shows: if the host navigates to a page with a BannerAd first (Uno Extensions does this when you await the navigation inside your startup code), the banner waits and loads its ad as soon as Initialize runs. Other ad formats need Initialize before you use them.
No hosting? new ServiceCollection().AddAdMob().BuildServiceProvider() works as well.
AddAdMob takes the same parameters as upstream's UseAdMob: default ad unit IDs per platform, automaticallyAskForConsent, disableConsentCheck and the targeting options (tagForChildDirectedTreatment, tagForUnderAgeOfConsent, maxAdContentRating).
The library starts the Google Mobile Ads SDK for you once consent allows ad requests.
Usage
Banner ads
<Page xmlns:admob="using:Uno.AdMob" ...>
<admob:BannerAd AdUnitId="ca-app-pub-xxxxxxxxxxxxxxxx/xxxxxxxxxx" />
</Page>
AdUnitId is optional with test ads. Other members: AdSize, CustomAdWidth, CustomAdHeight, IsLoaded and the events OnAdLoaded, OnAdFailedToLoad, OnAdImpression, OnAdClicked, OnAdSwiped, OnAdOpened, OnAdClosed. See Banner ads.
Interstitial ads
using Microsoft.Extensions.DependencyInjection;
using Uno.AdMob;
using Uno.AdMob.Services;
var service = AdMobPlatform.Services!.GetRequiredService<IInterstitialAdService>();
service.OnAdLoaded += (s, e) => service.ShowAd();
service.PrepareAd(); // or PrepareAd("your-ad-unit-id")
Or inject IInterstitialAdService wherever you like. Need per-ad events (OnAdShowed, OnAdDismissed...)? Use CreateAd() and subscribe to the returned IInterstitialAd.
Rewarded ads
using Microsoft.Extensions.DependencyInjection;
using Uno.AdMob;
using Uno.AdMob.Services;
var service = AdMobPlatform.Services!.GetRequiredService<IRewardedAdService>();
service.OnAdLoaded += (s, e) => service.ShowAd();
service.PrepareAd(onUserEarnedReward: reward => Console.WriteLine($"{reward.Amount} {reward.Type}"));
Rewarded interstitial ads
Same shape as rewarded ads, with IRewardedInterstitialAdService.
App open ads
Same shape as interstitial ads, with IAppOpenAdService.
Each format has its own page in the docs, with the full interface and the per-ad API.
Consent
When consent is required (for example in the EEA), the UMP form is shown automatically on startup, and ads are only requested once consent allows it. You can take control through IAdConsentService (LoadAndShowConsentFormIfRequired, CanRequestAds, IsPrivacyOptionsRequired, ShowPrivacyOptionsForm, Reset).
Two switches that are easy to mix up:
automaticallyAskForConsent: falsestops the form from showing on startup.disableConsentCheck: trueonly skips the "can we request ads?" gate before each ad request. The form still shows.
To see the form while developing, force a geography (works on test devices and emulators):
using Uno.AdMob;
using Uno.AdMob.Configuration;
services.AddConsentDebugSettings(new ConsentDebugSettings
{
Geography = ConsentDebugGeography.Eea,
Reset = true,
});
See Consent, including the iOS ATT notes.
Test ads
Set AdConfig.UseTestAdUnitIds = true and every ad unit ID is swapped for one of Google's test IDs. On real devices, also register the device:
using Uno.AdMob.Configuration;
AdConfig.AddTestDevice("<your-test-device-id>");
Never tap real ads on your own device, Google really dislikes that.
Unsupported platforms
On Windows, desktop and WebAssembly the package compiles and runs, so your shared code needs no #if. Nothing is shown though:
AdMobPlatform.IsSupportedisfalse.BannerAdstays empty and never raisesOnAdLoaded.- Loading an interstitial, rewarded, rewarded interstitial or app open ad raises
OnAdFailedToLoad("Ads are only supported on Android and iOS."). IAdConsentServicehas nothing to show, andIMobileAdsService.Initializationnever completes. If your code awaits it, give it a timeout, for exampleInitialization.WaitAsync(TimeSpan.FromSeconds(60)), or checkAdMobPlatform.IsSupportedfirst.
Documentation
- Setup: initialization, Android manifest and iOS
Info.plist - Configuration: default ad unit IDs, test ads, test devices
- Consent: GDPR consent with UMP, debug geographies
- Banner ads
- Interstitial ads
- Rewarded ads
- Rewarded interstitial ads
- App open ads
- Upgrading, including moving from Plugin.AdMob
- Troubleshooting
A working app lives in samples/Uno.AdMob.Sample: one button per ad format, an event log and the consent controls.
Staying in sync with upstream
Uno.AdMob mirrors Plugin.AdMob file by file, so upstream improvements can be ported with a plain diff. The synced version and the file-by-file map are in UPSTREAM.md ("How to sync").
License
MIT. AdMob is a trademark of Google LLC; this project has no affiliation with Google.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-android36.0 is compatible. net10.0-browser was computed. net10.0-ios was computed. net10.0-ios26.0 is compatible. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. net10.0-windows10.0.19041 is compatible. |
-
net10.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.14)
- Uno.WinUI (>= 7.0.65)
-
net10.0-android36.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.14)
- Uno.WinUI (>= 7.0.65)
- Xamarin.AndroidX.Fragment.Ktx (>= 1.9.1)
- Xamarin.Google.Android.Libraries.Ads.Mobile.Sdk (>= 1.5.0)
-
net10.0-ios26.0
- Jc.GMA.iOS (>= 12.10.0)
- Jc.UMP.iOS (>= 2.7.5)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.14)
- Uno.WinUI (>= 7.0.65)
-
net10.0-windows10.0.19041
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.14)
- Microsoft.Windows.SDK.BuildTools (>= 10.0.28000.2957)
- Microsoft.WindowsAppSDK (>= 2.5.1)
- Uno.WinUI (>= 7.0.65)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0-beta.21 | 75 | 11/21/2026 |
| 1.0.0-beta.17 | 81 | 11/18/2026 |