MarcTron.Admob version 1.4.3 is here

UPDATE: It seems there is a problem with Xamarin.Google.iOS.MobileAds version 7.47.0 that doesn’t allow you to compile your code. If this happens, downgrade Xamarin.Google.iOS.MobileAds to version 7.38.0

I’eve just released the new version of the best and most complete Google Admob plugin for Xamarin (Android and iOS).

The changes for this version are:

  •      Added Consent option to iOS
  •      Updated Xamarin.Google.iOS.MobileAds to 7.47.0

With this new version it is possible to decide if use personalised Ads or not on iOS.

In addition to this, the new version of Xamarin.Google.iOS.MobileAds should solve some issues with iOS 13.

How to use the plugin

With MarcTron.Admob you can add Banners, Interstitials and Rewarded Videos to your apps with a single line of code.

First of all, install the plugin from Nuget: https://www.nuget.org/packages/MarcTron.Admob/ . Remember to install it in you shared project and in your Android and iOS projects.

After installing it, in your Android project open your AndroidManifest.xaml and inside the application tag insert this code:

    <meta-data android:name="com.google.android.gms.ads.APPLICATION_ID"
               android:value="ca-app-pub-xxxxxxxxxxxxxxxx~xxxxxxxxxx"/>

Remember to use your actual ApplicationID (you can find it in you Admob dashboard).

If on iOS you have problems displaying your ads, install the Xamarin.Google.iOS.MobileAds plugin (it should be installed automatically but sometimes you have to do it manually).

Add a Banner

To add a Banner, in your XAML add the code:

<controls:MTAdView/>

remember to add this line in your XAML:

xmlns:controls="clr-namespace:MarcTron.Plugin.Controls;assembly=Plugin.MtAdmob"

That’s it.

If you have problems showing the Ads, try to set the style in App.xaml:

<OnIdiom x:TypeArguments="x:Double" x:Key="AdsHeight" Phone="50" Tablet="90"/>
            <Style TargetType="controls:MTAdView">
                <Setter Property="HeightRequest" Value="{StaticResource AdsHeight}"/>
            </Style>

Interstitials

You can add an Insterstitial with a single line of code:

CrossMTAdmob.Current.ShowInterstitial();

To load a new one:

CrossMTAdmob.Current.LoadInterstitial("xx-xxx-xxx-xxxxxxxxxxxxxxxxx/xxxxxxxxxx");

Rewarded Video

You can show a Rewarded video with a single line of code:

CrossMTAdmob.Current.ShowRewardedVideo();

To Load a Rewarded Video you can use this line:

CrossMTAdmob.Current.LoadRewardedVideo("xx-xxx-xxx-xxxxxxxxxxxxxxxxx/xxxxxxxxxx");

There is so much more

There are many other things you can do with this great plugin for Admob. You can find the full documentation here: https://www.xamarinexpert.it/admob-made-easy/