Jc.AdMob.Avalonia.Android
1.0.0
See the version list below for details.
dotnet add package Jc.AdMob.Avalonia.Android --version 1.0.0
NuGet\Install-Package Jc.AdMob.Avalonia.Android -Version 1.0.0
<PackageReference Include="Jc.AdMob.Avalonia.Android" Version="1.0.0" />
paket add Jc.AdMob.Avalonia.Android --version 1.0.0
#r "nuget: Jc.AdMob.Avalonia.Android, 1.0.0"
// Install Jc.AdMob.Avalonia.Android as a Cake Addin #addin nuget:?package=Jc.AdMob.Avalonia.Android&version=1.0.0 // Install Jc.AdMob.Avalonia.Android as a Cake Tool #tool nuget:?package=Jc.AdMob.Avalonia.Android&version=1.0.0
<h1 align="center"> <br> Jc.AdMob.Avalonia <br> </h1> <h4 align="center"> Library to bring AdMob advertisements to Avalonia mobile projects. </h4> <h6 align="center"> Avalonia solution derived from <a href="https://github.com/marius-bughiu/Plugin.AdMob/tree/main">marius-bughiu/Plugin.AdMob</a> </h6> <hr>
Table of Contents
Introduction
Jc.AdMob.Avalonia is a library to bring Google AdMob services to Avalonia Android and iOS projects.
The library currently supports the following ad units:
Banner | Interstitial | Rewarded interstitial | Rewarded | Native advanced | App open | ||
---|---|---|---|---|---|---|---|
Android | ✓ | ☓ | ☓ | ☓ | ☓ | ☓ | ☓ |
iOS | ✓ | ☓ | ☓ | ☓ | ☓ | ☓ | ☓ |
Usage
To use Jc.AdMob.Avalonia you must add the Jc.AdMob.Avalonia
pacakge to your cross-platform project.
dotnet add package Jc.AdMob.Avalonia
Followed by adding the Android/iOS Jc.AdMob.Avalonia.xxx
package to the platform specific project(s).
dotnet add package Jc.AdMob.Avalonia.Android
dotnet add package Jc.AdMob.Avalonia.iOS
Then you must register AdMob in the CustomizeAppBuilder
method in MainActivity.cs
and AppDelete.cs
for Android and iOS respectively:
protected override AppBuilder CustomizeAppBuilder(AppBuilder builder)
{
return base.CustomizeAppBuilder(builder)
...
.UseAdMob();
}
Banners
The BannerAd
control can be added to your XAML like so:
...
xmlns:admob="https://github.com/jc-admob-avalonia"
...
<admob:BannerAd UnitId="{ADMOB_UNIT_ID}" />
Sizes
The banner can be configured with the following sizes:
AdSize | Size |
---|---|
Banner | Mobile Marketing Association (MMA) banner ad size (320x50 density-independent pixels). |
FullBanner | Interactive Advertising Bureau (IAB) full banner ad size (468x60 density-independent pixels). |
Invalid | An invalid AdSize that will cause the ad request to fail immediately. |
LargeBanner | Large banner ad size (320x100 density-independent pixels). |
Leaderboard | Interactive Advertising Bureau (IAB) leaderboard ad size (728x90 density-independent pixels). |
MediumRectangle | Interactive Advertising Bureau (IAB) medium rectangle ad size (300x250 density-independent pixels). |
WideSkyscrapper | IAB wide skyscraper ad size (160x600 density-independent pixels). |
Note: If the size is left unspecified, the banner will resize to fit the parent container.
Events
The banner exposes the following events:
Event | Notes |
---|---|
OnAdLoaded | |
OnAdFailedToLoad | |
OnAdImpression | |
OnAdClicked | |
OnAdOpened | |
OnAdClosed | |
OnAdSwiped | Android only |
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0-android34.0 is compatible. |
-
net8.0-android34.0
- Avalonia (>= 11.1.1)
- Avalonia.Android (>= 11.1.1)
- Jc.AdMob.Avalonia (>= 1.0.0)
- Xamarin.GooglePlayServices.Ads.Lite (>= 122.6.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.