Implementing Interstitial Ad’s on Android

This is going to be a “quick tip” kind of tutorial just to clear up how to get interstitial ads on Android working.

Interstitial, that’s a funny word.

Interstitial ads are the type that display full screen. It is probably best not to over use these as they can be irritating for the user. I would suggest implementing at a natural segue in your app.

I find it odd that people don’t seem to read the Android documentation, favoring instead to search the web to see if anybody has the code. I would usually tell people to just look at the docs but in this case the documentation doesn’t seem to give the full story. At least, from what I can tell. The documentation can be found here, and it is obviously completely accurate. The only problem with it is that Interstitial Ads do no load immediately, so invariably when you call the method to show the ad there isn’t one to display. What you need to do is extend the abstract class AdListener as an inner class in your activity

Notice in the onAdLoaded method I am calling the displayInterstitual() method (as per the Google documentation).

Easy!

Further reading.

If you would like to know more about Android development I would recommend the following book. I find that the Big Nerd Range range of books very good and usually a bit more helpful than a lot of the tomes out there.

$35.80

Leave a Reply

Your email address will not be published. Required fields are marked *