[assembly: Dependency(typeof(InterstitialAdRenderer))]
namespace InterstitialAd.Droid
{
public class InterstitialAdRenderer : AdListener, IInterstitialAds
{
Android.Gms.Ads.InterstitialAd _ad;
public void Show()
{
var context = Android.App.Application.Context;
Android.Gms.Ads.InterstitialAd ad = new Android.Gms.Ads.InterstitialAd(context);
ad.AdUnitId = "ca-app-pub-9689514414757193/7233869569";
_ad = ad;
OnAdLoaded();
ad.AdListener = this;
var requestbuilder = new AdRequest.Builder();
ad.LoadAd(requestbuilder.Build());
}
public override void OnAdLoaded()
{
base.OnAdLoaded();
if (_ad.IsLoaded) // false
_ad.Show();
}
public override void OnAdFailedToLoad(int errorCode)
{
base.OnAdFailedToLoad(errorCode); // errorCode = 0
}
}
}
With the test ids that is provided on the site, ads work
https://developers.google.com/admob/android/test-ads#sample_ad_units
I using Xamarin.
Android:[assembly: Dependency(typeof(InterstitialAdRenderer))]
namespace InterstitialAd.Droid
{
public class InterstitialAdRenderer : AdListener, IInterstitialAds
{
Android.Gms.Ads.InterstitialAd _ad;
public void Show()
{
var context = Android.App.Application.Context;
Android.Gms.Ads.InterstitialAd ad = new Android.Gms.Ads.InterstitialAd(context);
ad.AdUnitId = "ca-app-pub-9689514414757193/7233869569";
_ad = ad;
OnAdLoaded();
ad.AdListener = this;
var requestbuilder = new AdRequest.Builder();
ad.LoadAd(requestbuilder.Build());
}
public override void OnAdLoaded()
{
base.OnAdLoaded();
if (_ad.IsLoaded) // false
_ad.Show();
}}public override void OnAdFailedToLoad(int errorCode)
{
base.OnAdFailedToLoad(errorCode); // errorCode = 0
}
}
This ad id exists for several days already. In iOS this problem too.
--What is the problem?
---
You received this message because you are subscribed to the Google Groups "Google Mobile Ads SDK Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads-sdk+unsub...@googlegroups.com.
To post to this group, send email to google-admob-ads-sdk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-admob-ads-sdk/e64d0af1-db01-40e6-86b8-efd18fcfd63e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.