Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Display admob banner & interstitial in Xamarin Native Android app

I have created one app using xamarin android native.

Now I want to display admob ads in that, both banner & interstitial.

But I did not found any step by step good tutorial.

I found few, but it was for xamarin.forms not for native.

So can any one give me link of that, OR if any one has done this kind of task then please share steps so I can integrate it.

Thanks

like image 293
PMS Admin Avatar asked Mar 03 '18 08:03

PMS Admin


2 Answers

using Android.Gms.Ads;

...

var adView = new AdView(Context);
adView.AdUnitId = "ca-app-pub-3756076456456456/1111123234/app320x250";
adView.AdSize = new AdSize(300, 250);

// do whatever with adView, add as child, set as native control (if using ViewRenderers etc)
// OR

var interstitialAd = new InterstitialAd(Context);
interstitialAd.AdUnitId = "ca-app-pub-434343434/34343434/myinterstitial";

var requestbuilder = new AdRequest.Builder();
interstitialAd.LoadAd(requestbuilder.Build());
interstitialAd.Show();
like image 101
Artūras Paleičikas Avatar answered Oct 22 '22 21:10

Artūras Paleičikas


I managed it working using below example link.

https://developer.xamarin.com/samples/monodroid/google-services/AdMobExample/

So if any one still does not get work, then you can ask me question.

Thanks

like image 23
PMS Admin Avatar answered Oct 22 '22 22:10

PMS Admin