mg-code-solutions / MgAdmob

Utilise Google Admob Ads (banners, interstitial, and rewarded videos) in your Xamarin Projects (Android and iOS)
MIT License
4 stars 1 forks source link
admob ads banner-ads google google-admob google-ads interstitial-ads mgadmob plugin rewarded-video-ads xamarin xamarin-android xamarin-forms xamarin-ios

MgAdmob plugin for Xamarin (Android & iOS)

Utilise Google Admob Ads (banners, interstitial, and rewarded videos) in your Xamarin Projects (Android and iOS)

Originally based on the MtAdmob project

Setup

This plugin supports:

How to Use MgAdMob Banner Ads

There are two options available for adding banner ads to your app

1) XAML

Remember to replace ca-app-pub-xxxxxxxxxxxxxxxx/yyyyyyyyyy with your Ad Unit Id from Google Admob

<controls:MgAdView AdUnitId="ca-app-pub-xxxxxxxxxxxxxxxx/yyyyyyyyyy"/>

Add this line in your XAML:

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

MgBannerAdView AdUnitId can be customised for Android and iOS by using the OnPlatform tag as shown in the example below (test Ad Unit Ids shown):

<controls:MgBannerAdView    
    AdUnitId="{OnPlatform Android='ca-app-pub-3940256099942544/6300978111', iOS='ca-app-pub-3940256099942544/2934735716'}"
    />

Alternatively, for all banners in your app you can set the AdUnitId property via a