Categories
Programación

AdMob Android the easy Way

I have struggled to find a nice way to integrate AdMob to my apps, this tutorial is for Admob in Xamarin.Forms Android and it’s the most simple way I have found currently.

I would make things short.

Step 1

Install NuGet Xamarin.GooglePlayServices.Ads.Lite

For Step 2 Create in a Control folder this class.

Step 3 For the Android Project create a class in a folder name CustomRenderers and paste the following code changing the name of your app.

Now in Step 4, in your Xaml add this at the top using the name of your app.

xmlns:ads=”clr-namespace:MYAPP.Controls”

Step 5

Put the banner on the page you need by adding this line to your xaml.

<ads:AdMobView/>

Step 6

Test your app. It will look something like this.

Ad testing image from Google Admob Android in Visual Studio 2019

Due to changes in the Android SDK in your manifest file now you have to add this portion of code inside the application

You can look for more documentation on Microsoft Page. And if you want to use interstitial add follow this link.

Conclusion: Admob is important for new developers that one to use Ads, doing it simply is key, and doing a class that it is updated and that can be used in any other app is important. Using Admob Android you will get a simple class that can be used across all your apps.

1 reply on “AdMob Android the easy Way”

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *