Plugin.MauiMTAdmob
3.1.0
dotnet add package Plugin.MauiMTAdmob --version 3.1.0
NuGet\Install-Package Plugin.MauiMTAdmob -Version 3.1.0
<PackageReference Include="Plugin.MauiMTAdmob" Version="3.1.0" />
<PackageVersion Include="Plugin.MauiMTAdmob" Version="3.1.0" />
<PackageReference Include="Plugin.MauiMTAdmob" />
paket add Plugin.MauiMTAdmob --version 3.1.0
#r "nuget: Plugin.MauiMTAdmob, 3.1.0"
#:package Plugin.MauiMTAdmob@3.1.0
#addin nuget:?package=Plugin.MauiMTAdmob&version=3.1.0
#tool nuget:?package=Plugin.MauiMTAdmob&version=3.1.0
MAUIMtAdmob plugin for MAUI (Android & iOS)
With this Plugin you can add Google Admob Ads inside your MAUI Projects with a single line of code!!! This plugin supports: Banners, Collapsible Banners, a banner fallback for slots AdMob can't fill, Interstitials, Rewarded, Rewarded Interstitials, App Open Ads, Native Ads and Consent (only in the licensed version).
Version 3: Google Mobile Ads Next-Gen SDK
From version 3.0, Android runs on Google's Google Mobile Ads Next-Gen SDK, which Google has made the preferred SDK for Android. iOS keeps using the Google Mobile Ads SDK 12.x, because Google has not released a Next-Gen SDK for iOS.
The public API is the same as in 2.x. The namespace, the controls, the events and every method signature are unchanged, so updating is normally just a package update (see Updating from 2.x below).
Which version should you use?
- 3.x (this version): Android on the Next-Gen SDK. Requires Android minSdk 24.
- 2.x: Android on the legacy Google Mobile Ads SDK. Still maintained for apps that cannot move yet: apps that need minSdk below 24, or that mediate through a platform other than AdMob.
PLEASE READ
Support for the consent required by Google for all the final users living in Europe (UMP) is only available in the licensed version of the plugin, together with App Open Ads and Native Ads. Without the license, the plugin will continue to work as usual with all the other features normally available. This will allow me to continue supporting the development of the plugin. You can buy the license at https://hightouchinnovation.com/MMTAdmob If you are a charity or your app is used to support a good cause, contact me and I'll evaluate it to send you a free license.
Licence keys and version 3: a "1 Major Version" licence is valid for the major version it was bought for. A key bought for 2.x keeps working on every 2.x release, but not on 3.x: to use the licensed features on 3.x you need a 3.x key. Perpetual ("Supporter") licences are valid for all versions, including 3.x.
Setup
- Available on Nuget: https://www.nuget.org/packages/Plugin.MauiMTAdmob/
- Install in your MAUI project
This plugin supports:
- Maui (Android and iOS)
- .NET 10
- Android 7.0 (API 24) and later, iOS 15.4 and later
Updating from 2.x
- Update
Plugin.MauiMTAdmobto 3.x. - Raise your Android
SupportedOSPlatformVersionto 24.0 in your app's csproj. The Next-Gen SDK requires minSdk 24, whereas 2.x allowed 21:
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">24.0</SupportedOSPlatformVersion>
- Leave your code as it is.
Everything else (.UseMauiMTAdmob(), CrossMauiMTAdmob.Current, MTAdView, MTNativeAdView,
the events, the consent calls) is unchanged.
Behaviour differences on Android
- Initialisation runs in the background. The Next-Gen SDK fails if an ad is loaded before it has
finished initialising, and its initialisation must not run on the UI thread. The plugin runs it for
you inside
Init(...)on a background thread, and anyLoad*,SetAppMuted,SetAppVolumeorOpenAdInspectorcall made while it is still running is queued and executed as soon as it finishes, so code that loads an ad right afterInitkeeps working.OnMobileAdsInitializedis raised once the queued work has started. - With AdMob mediation, the first request may not have every adapter ready. The Next-Gen SDK only
reports mediation adapter initialisation once every adapter is ready or a 30 second timeout
elapses. Waiting for it would stall banners for up to half a minute, so the plugin raises
OnMobileAdsInitializedas soon as the SDK itself is ready, as Google's own sample app does. - Error codes are unchanged, the domain is not.
MTEventArgs.ErrorCodekeeps Google's numeric codes (2= network error,3= no fill,8= app id missing, ...), so existing comparisons keep working.ErrorDomainis nowcom.google.android.libraries.ads.mobile.sdk(it wascom.google.android.gms.ads). - Child-directed / under-age tags become an age treatment. The Next-Gen SDK replaced
TagForChildDirectedTreatmentandTagForUnderAgeOfConsentwith a single age treatment. The plugin keeps both properties and applies Google's documented mapping: if either isTruethe request gets the child treatment, otherwise none. - Anchored adaptive banners use Google's "large" size.
AnchoredAdaptive(andSmart, which the Next-Gen SDK removed) request the large anchored adaptive size Google recommends, which can be slightly taller. - Banner refreshes raise
AdsLoadedagain, and the banner's height follows the new creative. - Interstitials ignore the Android back key, as the Next-Gen SDK does. Users close them with the close button.
- Ad Manager and AdMob requests are unified in the Next-Gen SDK. The
LoadAdManager*/ShowAdManager*methods still exist and keep their own ad queues, so your code does not change. - Mediation. The Next-Gen SDK only supports AdMob mediation. If you mediate through another platform, stay on 2.x for now.
Banners in 3.1
AdSizedefaults toAnchoredAdaptive(full width) on Android and iOS. Android used to default to a fixed 320x50: setAdSize="Banner"to keep that size. On iOS,AdSizeis now honoured (it was always anchored adaptive before).- Hidden banners don't load. A banner with
IsVisible = falseis not loaded automatically (on start, when the SDK is ready or after consent); it loads when it becomes visible. Requesting ads nobody can see is against AdMob's rules.LoadAd()you call yourself is not affected. - An ad narrower than its slot is centred (for example a 320x50 ad on a tablet).
- The banner's native view is now a container holding Google's
AdView/GADBannerView. Only code that cast the handler'sPlatformViewto one of those needs updating.
Banner fallback (3.1)
When AdMob can't fill a banner (no fill, no network, a wrong ad unit), the slot normally stays empty. With a fallback you can show your own view there instead, for example a promotion of your other apps or a "Go Pro" banner. It works in the free and the licensed version.
CrossMauiMTAdmob.Current.BannerFallback = new MyFallback();
class MyFallback : IMTBannerFallback
{
public Task<View?> CreateViewAsync(MTBannerFallbackRequest request, CancellationToken cancellationToken)
{
// request.Width / request.Height: the slot size; request.Error: why AdMob didn't fill it.
View view = new Label { Text = "Also by us: My Other App", HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center };
return Task.FromResult<View?>(view); // or null: leave the banner as it is
}
public void OnViewRemoved(View view) { /* stop anything the view was doing */ }
}
Every MTAdView uses it; set UseFallback="False" on a banner to keep that one AdMob only.
How it works:
- The banner loads as usual. Once it has shown an ad, the fallback is never used for it again (a failed refresh keeps the old ad on screen).
- If it fails before showing an ad, the AdMob view is destroyed, so it can't request or refresh out of sight, and your view is shown in the same slot at a fixed height, so the page doesn't move.
- After 60 seconds your view is removed and a fresh AdMob view is loaded in the visible slot. If that fails too, your view comes back and the next try waits 2 minutes, then 5 minutes.
- Nothing is retried while the app is in the background or the banner is hidden or off screen.
AdMob and your view are never shown together. Make your view clearly yours (your own label and style),
never something that looks like a Google ad. Don't hide the banner in AdsFailedToLoad when you use a
fallback: a hidden banner shows nothing and its retries wait until it is visible again.
Works well with BeeAppie
BeeAppie fills empty banner slots with promos of your own apps, through this fallback.
Add the package BeeAppie.Maui.MTAdmob and one line in MauiProgram.cs; your pages don't change:
builder.UseMauiApp<App>().UseMauiMTAdmob().UseBeeAppie("your-app-key").UseBeeAppiePromos();
BeeAppie picks the promo, counts views and taps, and lets you choose in its dashboard which promos show. Guide: Promos in empty AdMob banners.
Impression-level ad revenue, Ad Inspector, privacy and targeting
CrossMauiMTAdmob.Current.OnAdPaidreports the revenue of every ad (banner, interstitial, rewarded, rewarded interstitial, app open and native) with its format, ad unit, value, currency, precision and ad source - forward it to Firebase or your attribution SDK. Enable impression-level ad revenue in the AdMob UI for the values to be populated.CrossMauiMTAdmob.Current.OpenAdInspector()opens Google's Ad Inspector (test devices only);OnAdInspectorClosedreports when it closes or why it could not open.PublisherPrivacyPersonalizationStatesets Google's publisher privacy treatment (Disabledturns off personalized ads for the session).ContentUrlandNeighboringContentUrlssend content mapping with every request.CustomTargetingsends key-value targeting with every request (Google Ad Manager).
Native ads
Give the MTMediaView in your native ad template at least 120x120: Google requires it for video ads,
and the native ad validator flags anything smaller. Avoid * rows around the media view in a Grid
template, because they can shrink it below its requested size.
Android
You still need your Admob APPLICATION_ID in your AndroidManifest.xml (the UMP SDK reads it from there):
<meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="YOUR APPLICATION ID" />
iOS
You need to add GADApplicationIdentifier to your Info.plist. Edit your info.plist adding these Keys:
<key>GADApplicationIdentifier</key>
<string>YOUR APPLICATION ID</string>
<key>GADIsAdManagerApp</key>
<true/>
To show the App Tracking Transparency dialog (the plugin asks for it after the consent form), also add:
<key>NSUserTrackingUsageDescription</key>
<string>This identifier will be used to deliver personalized ads to you.</string>
Without this key iOS never shows the dialog and tracking is always denied.
Consent not showing?
Turn on debug mode (CrossMauiMTAdmob.Current.DebugMode = true, or debugMode: true in Init): the plugin then logs each step of the consent flow, prefixed with [MauiMTAdmob], so you can tell a form that was not required from one that failed.
With SkipConsent = true and initialiseConsentAtStartup: false, ads don't start until your app calls
CrossMauiMTAdmob.Current.InitialiseConsent() (after your own consent flow). In debug mode the plugin says so
in the console. Debug mode also logs every banner request ([MauiMTAdmob] Banner request: <ad unit>).
VERY IMPORTANT
If you encounter an error on this plugin check the guide at https://hightouchinnovation.com/MMTAdmobGuide where you can find also common issues and how to solve them.
You can also report any issue at https://github.com/marcojak/MauiMTAdmob/issues
The Consent might not work on the iOS simulator (it usually depends on the xCode version you have installed on your Mac). If it doesn't work, you can change your XCode version or test it on a real device.
To test the plugin on iOS you need to use a Mac as the device directly connected to Windows is not supported.
FOR MAC USERS WITH Mx PROCESSORS
If you compile the app on a Mac with Mx processors, you could get an error about architecture, to fix it, add to your csproj file these lines:
<PropertyGroup Condition="$(TargetFramework.Contains('-ios'))">
<RuntimeIdentifier>iossimulator-x64</RuntimeIdentifier>
</PropertyGroup>
<PropertyGroup>
<ForceSimulatorX64ArchitectureInIDE>true</ForceSimulatorX64ArchitectureInIDE>
</PropertyGroup>
How to use MauiMTAdmob
In your MauiProgram class, add
builder.UseMauiMTAdmob();
You can find the full guide here: https://hightouchinnovation.com/MMTAdmobGuide
LINKS
To buy the license visit https://hightouchinnovation.com/MMTAdmob Available on Nuget: https://www.nuget.org/packages/Plugin.MauiMTAdmob/ Guide: https://hightouchinnovation.com/MMTAdmobGuide (you'll find here also the common issues and how to solve them) Release notes: https://github.com/marcojak/MauiMTAdmob/blob/master/CHANGELOG.md To report any issue: https://github.com/marcojak/MauiMTAdmob/issues
CRYPTOGRAPHY
This plugin uses a cryptographic algorithm to handle the license.
DISCLAIMER OF LIABILITY
By using MAUIMtAdmob (the "Plugin"), you agree that:
- The Plugin is provided "as is" without any warranties or guarantees of any kind, either expressed or implied.
- I shall not be responsible or liable for any direct, indirect, incidental, special, or consequential damages arising out of the use or inability to use the Plugin.
- I do not warrant that the Plugin will meet your specific requirements or operate without interruption.
You acknowledge that the use of the Plugin is at your own risk. The author of the plugin disclaims all liability for any damage to your computer system or loss of data that results from the use of the Plugin.
This disclaimer of liability is a fundamental part of the agreement between you and the author of the plugin. You agree that the limitations and exclusions of liability set forth in this disclaimer are reasonable and fair.
If you do not agree to these terms, do not use the Plugin.
| 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-maccatalyst26.0 is compatible. 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.Maui.Controls (>= 10.0.10)
-
net10.0-android36.0
- Microsoft.Maui.Controls (>= 10.0.10)
- Xamarin.AndroidX.Fragment.Ktx (>= 1.9.0)
- Xamarin.Google.Android.Libraries.Ads.Mobile.Sdk (>= 1.4.0)
- Xamarin.Google.UserMessagingPlatform (>= 4.0.0.4)
-
net10.0-ios26.0
- Microsoft.Maui.Controls (>= 10.0.10)
- MTAdmob.iOS.Binding (>= 12.12.0)
- MTAdmob.UMP.iOS.Binding (>= 3.0.0)
- Portable.BouncyCastle (>= 1.9.0)
-
net10.0-maccatalyst26.0
- Microsoft.Maui.Controls (>= 10.0.10)
-
net10.0-windows10.0.19041
- Microsoft.Maui.Controls (>= 10.0.10)
NuGet packages (6)
Showing the top 5 NuGet packages that depend on Plugin.MauiMTAdmob:
| Package | Downloads |
|---|---|
|
MetaFrm.Maui.Essentials.net8.0
Meta Framework (Multi platform & Meta management) |
|
|
MetaFrm.Maui.Essentials.net9.0
Meta Framework (Multi platform & Meta management) |
|
|
MetaFrm.Maui.Essentials.net7.0
Meta Framework (Multi platform & Meta management) |
|
|
MetaFrm.Maui.Essentials.net10.0
Meta Framework (Multi platform & Meta management) |
|
|
AnchorAppsIT.MAUI.Controls
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.1.0 | 0 | 11/27/2026 |
| 3.0.0 | 2,013 | 10/16/2026 |
| 2.6.1 | 0 | 11/27/2026 |
| 2.6.0 | 222 | 10/16/2026 |
| 2.5.1 | 189 | 10/13/2026 |
| 2.5.0 | 653 | 10/5/2026 |
| 2.4.0 | 9,046 | 3/18/2026 |
| 2.3.1 | 1,704 | 2/1/2026 |
| 2.3.0 | 324 | 1/30/2026 |
| 2.2.0 | 4,243 | 11/5/2025 |
| 2.1.0 | 1,256 | 10/8/2025 |
| 2.0.2 | 16,162 | 5/21/2025 |
| 2.0.1.1 | 848 | 5/2/2025 |
| 2.0.1 | 623 | 5/1/2025 |
| 2.0.0.5 | 3,230 | 2/14/2025 |
| 1.7.1 | 3,229 | 11/27/2024 |
| 1.7.0 | 1,108 | 11/2/2024 |
| 1.6.4 | 3,989 | 9/17/2024 |
| 1.6.3 | 2,577 | 9/3/2024 |
| 1.6.2 | 534 | 9/1/2024 |
Version 3.1: banner fallback. Show your own view (for example a promotion of your other apps) in a banner slot AdMob could not fill, with no hidden requests: the AdMob view is destroyed meanwhile and retried after 60 s, 2 and 5 min while the banner is on screen.
- New: CrossMauiMTAdmob.Current.BannerFallback (IMTBannerFallback, free and licensed) and MTAdView.UseFallback.
- Changed: MTAdView.AdSize defaults to AnchoredAdaptive on Android and iOS (Android used to default to 320x50: set AdSize="Banner" to keep it).
- Fixed: hidden banners (IsVisible = false) load only once visible; iOS honours AdSize and no longer fails a banner shown after being hidden; Android no longer loses AdsImpression / OnAdPaid of a banner loading into a visible slot; no crash when a page closes while its banner loads; narrow ads are centred.
- Debug mode logs each banner request, and says when ads wait for InitialiseConsent() because SkipConsent is on.
Full notes: https://github.com/marcojak/MauiMTAdmob/blob/master/CHANGELOG.md