I tried recently to try to use Google AdMob on my Xamarin Android application. However, I have not been able to succeed. First of all, I'm not able to follow tutorials, (for instance, this one: https://blog.tommyparnell.com/admob-with-xamarin-part-1-banner-ads/), here it is saying to go to "get more components" (I'm using Xamarin Studio) and download Google Play Services (Jellybean). However, I'm not able to find it, instead I find a lot of Google Play Services components. I have tried to install the one called: "Google Play Services - Ads" ( I imagine that this one is the one related with Admobs). However, seems that something is not working, the component appears like inactivated and it is saying the following:
Some required packages are not referenced by the project
I'm quite desperate and really don't know how to proceed. What can I do? Also note that I have the latest version of the SDK. Could be that the problem? If so, how can I fix the thing?
thanks in advance
That tutorial that you referred to is out-dated and is using the deprecated version of the "Xamarin Google Play Services - All" package.
You want the individual "Ads" package that will provide the ADMob
namespace (using ADMob;
) that will also install the related Play Service dependencies and you have to update the code accordingly from the tutorial to match the new Ads namespace/api. The overall code and process presented for showing ads is valid.
Open the Package Manager and search for "Xamarin Google Play Services Ads"
>Install-Package Xamarin.GooglePlayServices.Ads -Version 27.0.0
Nuget Page:
https://www.nuget.org/packages/Xamarin.GooglePlayServices.Ads/27.0.0
Latest Beta Version:
https://www.nuget.org/packages/Xamarin.GooglePlayServices.Ads/28.0.0-beta1
The 'Xamarin Google Play Services - All' nuget package is now deprecated.
You should instead use the individual NuGet packages to get only the bindings you need in your application.
You can find the individual packages by searching for 'xamarin google play services': https://www.nuget.org/packages?q=xamarin+google+play+services