benxu.AppPlatform.Ads.AdMob
3.2.7
dotnet add package benxu.AppPlatform.Ads.AdMob --version 3.2.7
NuGet\Install-Package benxu.AppPlatform.Ads.AdMob -Version 3.2.7
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="benxu.AppPlatform.Ads.AdMob" Version="3.2.7" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="benxu.AppPlatform.Ads.AdMob" Version="3.2.7" />
<PackageReference Include="benxu.AppPlatform.Ads.AdMob" />
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 benxu.AppPlatform.Ads.AdMob --version 3.2.7
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: benxu.AppPlatform.Ads.AdMob, 3.2.7"
#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 benxu.AppPlatform.Ads.AdMob@3.2.7
#: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=benxu.AppPlatform.Ads.AdMob&version=3.2.7
#tool nuget:?package=benxu.AppPlatform.Ads.AdMob&version=3.2.7
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
benxu.AppPlatform.Ads.AdMob
AdMob 廣告服務實作層,封裝 Plugin.AdMob SDK 並提供 Mock 測試模式。
功能
- ✅ Banner 廣告(真實 SDK / Mock)
- ✅ Native 廣告(真實 SDK / Mock)
- ✅ Interstitial 廣告(真實 SDK / Mock)
- ✅ Rewarded 廣告介面(預留)
- ✅ 三種廣告模式:Production / Test / Mock
- ✅ Premium 用戶自動隱藏廣告
安裝
dotnet add package benxu.AppPlatform.Ads.AdMob
快速開始
1. 註冊服務
// MauiProgram.cs
builder.UseAppPlatform(options =>
{
options.UseAdMob(ads =>
{
ads.Mode = AdMode.Mock; // 開發階段使用 Mock
ads.AndroidBannerAdUnitId = "ca-app-pub-xxx/xxx";
ads.IosBannerAdUnitId = "ca-app-pub-xxx/xxx";
ads.AndroidNativeAdUnitId = "ca-app-pub-xxx/xxx";
ads.IosNativeAdUnitId = "ca-app-pub-xxx/xxx";
});
});
2. 加入 Native Ad 容器(真實 / Test 模式)
在 MainPage.xaml(或任何 MAUI Page)加入 Native Ad Host:
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:admob="clr-namespace:benxu.AppPlatform.Ads.AdMob.Views;assembly=benxu.AppPlatform.Ads.AdMob">
<Grid RowDefinitions="*,Auto">
<admob:AdMobNativeAdHostView Grid.Row="1" />
</Grid>
</ContentPage>
3. 使用 Banner 元件(Blazor)
@inject IBannerAdService BannerAd
<AdBanner />
在 Test / Production 模式下,
AdBanner只負責觸發載入與顯示,實際廣告由AdMobNativeAdHostView原生顯示。
廣告模式
| 模式 | 說明 |
|---|---|
| Production | 使用真實廣告,需正式 Ad Unit ID |
| Test | 使用 Google 官方測試廣告 |
| Mock | 不呼叫 SDK,顯示佔位 UI |
依賴
benxu.AppPlatform.Ads.CorePlugin.AdMob2.3.2-beta.7
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0-android36.0 is compatible. net10.0-ios26.0 is compatible. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0-android36.0
- benxu.AppPlatform.Ads.Core (>= 3.2.7)
- Microsoft.Maui.Controls (>= 10.0.0)
- Plugin.AdMob (>= 2.3.2-beta.7)
- Xamarin.AndroidX.Activity (>= 1.10.1.3)
- Xamarin.AndroidX.Activity.Ktx (>= 1.10.1.3)
- Xamarin.AndroidX.Collection (>= 1.5.0.3)
- Xamarin.AndroidX.Collection.Jvm (>= 1.5.0.3)
- Xamarin.AndroidX.Collection.Ktx (>= 1.5.0.3)
- Xamarin.Build.Download (>= 0.11.4)
-
net10.0-ios26.0
- benxu.AppPlatform.Ads.Core (>= 3.2.7)
- Microsoft.Maui.Controls (>= 10.0.0)
- Plugin.AdMob (>= 2.3.2-beta.7)
- Xamarin.Build.Download (>= 0.11.4)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on benxu.AppPlatform.Ads.AdMob:
| Package | Downloads |
|---|---|
|
benxu.AppPlatform.MAUI.Bootstrap
Bootstrap package for benxu App Platform. Provides fluent API for one-line service registration and lifecycle management. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.2.7 | 54 | 6/5/2026 |
| 3.2.6 | 86 | 5/30/2026 |
| 3.2.5 | 99 | 4/25/2026 |
| 3.2.4 | 60 | 4/25/2026 |
| 3.2.3 | 72 | 4/23/2026 |
| 3.2.2 | 78 | 4/22/2026 |
| 3.2.1 | 77 | 4/17/2026 |
| 3.2.0 | 79 | 4/11/2026 |
| 3.1.9 | 68 | 4/10/2026 |
| 3.1.8 | 65 | 4/10/2026 |
| 3.1.7 | 70 | 4/10/2026 |
| 3.1.6 | 74 | 4/10/2026 |
| 3.1.5 | 65 | 4/9/2026 |
| 3.1.4 | 75 | 4/7/2026 |
| 3.1.3 | 83 | 3/24/2026 |
| 3.1.2 | 72 | 3/23/2026 |
| 3.1.1 | 74 | 3/22/2026 |
| 3.1.0 | 65 | 3/22/2026 |
| 3.0.9 | 70 | 3/20/2026 |
| 3.0.8 | 72 | 3/19/2026 |
Loading failed