3

When trying to display an interstitial ad on our app, the ad doesn't display correctly.

When the app runs on the 720p emulator then the ad displays with the correct size: 720p screen

On the WVGA the ad gets cut off in one quarter (seems that the size of the ad is for the 720p screen): WVGA screen

As for the WXGA the ad displays with a white border around it (I'm guessing that like the WVGA, the ad size is for the 720p screen): WXGA

We tested on a device to be sure that the problem wasn't emulator specific, but we got the same results.

This is the code we used to create the ad:

InterstitialAd _ad = new InterstitialAd("<ADMOB_ID>");
AdRequest adRequest = new AdRequest();
_ad.ReceivedAd += delegate(object sender, AdEventArgs e)
{
    _ad.ShowAd();
};
_ad.LoadAd(adRequest);

Is there a way to define the ad size? Or this is a bug on the AdMob SDK?

Marco Batista
  • 1,410
  • 1
  • 20
  • 38

3 Answers3

1

Its pointless anyways because WP apps crash with the latest Abmob SDK when the user clicks on the ad and presses the back button.

  • There is a workaround for that (source: https://groups.google.com/d/msg/google-admob-ads-sdk/vw61ZdJALYo/OyOwBtV8URUJ). Basically in your App.xaml.cs, add this: `private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) {if(Debugger.IsAttached){Debugger.Break();} if(e.ExceptionObject==null||e.ExceptionObject.Message==null){return;} String ex = e.ExceptionObject.ToString().ToLower(); if(ex.Contains("frameworkdispatcher.update")||ex.Contains("the given key was not present in the dictionary")){e.Handled = true;}else{}}` It's not pretty but it works :) – Marco Batista Apr 19 '14 at 10:41
  • No there isnt. That fix is for a 'different' bug. That fix addresses the fact that your app will fail certification because the AdMob SDK (even using banner ads) knocks out the devices audio. The code you quoted works around that. AFAIK, there is no fix for the Intersitial ad crashing the app on pressing 'back' button. – user3460731 Apr 19 '14 at 13:30
  • hm.. weird, it is working on our app, so I guess we got lucky :) – Marco Batista Apr 19 '14 at 22:43
  • When an ad is served, click on the ad. When you try to go back to your app using the back button, the app will likely crash. This bug is widely reported and AdMob is aware of it but seem uninterested in fixing it. – user3460731 Apr 20 '14 at 04:59
  • Yeah, I know, but like I said, it isn't crashing on our app (at least since we added that bit of code [which by the way is different from the one that I linked to]). The only issues we have now are: the ad doesn't close on its own (like Android or iOS) and the incorrect display of the ads on smaller and bigger screens than the 720p – Marco Batista Apr 21 '14 at 07:17
0

Finally I found some info on the issue.. not good news I'm afraid.

According to a member of the AdMob SDK this is a known bug that doesn't have a fix yet.

Source: AdMob SDK Google Goup - WP8 known issue

Marco Batista
  • 1,410
  • 1
  • 20
  • 38
0

No need to give Size etc... just follow the following code, it works for me on Windows Phone 8 very well.

namespace MainPage
{
  public partial class MainPage: PhoneApplicationPage
   {
       private InterstitialAd interstitialAd;
       private AdRequest adRequest;

       public MainPage()
       {
          InitializeComponent();
          InterstitialAds();
       }

       private void InterstitialAds()
       {
          interstitialAd = new InterstitialAd("Unit-ID"); // Unit ID is a Unique Key pri
          adRequest = new AdRequest();

          interstitialAd.ReceivedAd += OnAdReceived;
          interstitialAd.LoadAd(adRequest);
        }

       private void OnAdReceived(object sender, AdEventArgs e)
       {
           System.Diagnostics.Debug.WriteLine("Ad received successfully");
           interstitialAd.ShowAd();
       }
    }
}
Zia Ur Rahman
  • 1,850
  • 1
  • 21
  • 30