Jc.AdMob.Avalonia.Android 1.0.0

There is a newer version of this package available.
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                
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="Jc.AdMob.Avalonia.Android" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Jc.AdMob.Avalonia.Android --version 1.0.0                
#r "nuget: Jc.AdMob.Avalonia.Android, 1.0.0"                
#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.
// 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 Compatible and additional computed target framework versions.
.NET net8.0-android34.0 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.4.0 107 10/20/2024
1.3.0 109 10/19/2024
1.2.1 131 8/18/2024
1.2.0 123 8/16/2024
1.1.0 100 8/1/2024
1.0.0 102 7/30/2024