MZikmund.Uno.AdMob 1.0.0-beta.21

This is a prerelease version of MZikmund.Uno.AdMob.
dotnet add package MZikmund.Uno.AdMob --version 1.0.0-beta.21
                    
NuGet\Install-Package MZikmund.Uno.AdMob -Version 1.0.0-beta.21
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MZikmund.Uno.AdMob" Version="1.0.0-beta.21" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MZikmund.Uno.AdMob" Version="1.0.0-beta.21" />
                    
Directory.Packages.props
<PackageReference Include="MZikmund.Uno.AdMob" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MZikmund.Uno.AdMob --version 1.0.0-beta.21
                    
#r "nuget: MZikmund.Uno.AdMob, 1.0.0-beta.21"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MZikmund.Uno.AdMob@1.0.0-beta.21
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MZikmund.Uno.AdMob&version=1.0.0-beta.21&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=MZikmund.Uno.AdMob&version=1.0.0-beta.21&prerelease
                    
Install as a Cake Tool

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

<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.

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: false stops the form from showing on startup.
  • disableConsentCheck: true only 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.IsSupported is false.
  • BannerAd stays empty and never raises OnAdLoaded.
  • Loading an interstitial, rewarded, rewarded interstitial or app open ad raises OnAdFailedToLoad ("Ads are only supported on Android and iOS.").
  • IAdConsentService has nothing to show, and IMobileAdsService.Initialization never completes. If your code awaits it, give it a timeout, for example Initialization.WaitAsync(TimeSpan.FromSeconds(60)), or check AdMobPlatform.IsSupported first.

Documentation

  1. Setup: initialization, Android manifest and iOS Info.plist
  2. Configuration: default ad unit IDs, test ads, test devices
  3. Consent: GDPR consent with UMP, debug geographies
  4. Banner ads
  5. Interstitial ads
  6. Rewarded ads
  7. Rewarded interstitial ads
  8. App open ads
  9. Upgrading, including moving from Plugin.AdMob
  10. 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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