Tutorial Admob, banners and interstitials

Rob Hewitt

Active member
Tutorial Author
Aug 30, 2017
For my first Android Play Store release (Wormy The Worm Like Snake, please go get it. :) ) I wanted a banner ad for the title page and an interstitial for after Game Over. So after a bit of trial and error (which is why I'm writing this!) I did the following:

(This assumes that all the corrects SDKs are installed for Android eg Google Play Services)

Created an Admob account at https://apps.admob.com/admob/signup

And on this site I:

added an app under the Apps section
created a banner ad and an interstitial ad and made a note of the Ad Unit IDs

In my code in Cerberus I included the following at the top:

Import mojo 
Import brl.admob
"ca-app-pub-xxxxxxxxxxxxxxxx/xxxxxxxxxx" - this is actually the Ad unit ID of the banner ad, without this no banners wil show

I then added the following under the Class
Class wormy Extends App

    ' admob bit
    Field admob:Admob
    Field interstitialAdmob:AdmobInterstitial
    Field layout:=1
    Field state:=1
(Although i think I only used the first 2 fields, they were copied from the docs example)

Under OnCreate I added:
    Method OnCreate:Int()
        admob.ShowAdView 1,5
"ca-app-pub-xxxxxxxxxxxxxxxx/xxxxxxxxxx" - this is the Ad unit ID of the interstitial ad

i did call admob.ShowAdView 1,5 once at the beginning of ingame but I'm not sure if it was necessary

I also called the interstitial once at the end of the Game Over section using this code
So that the banner would return I also created an OnResume method otherwise the banner didn't return after the interstitial:
    Method OnResume:Int()
        admob.ShowAdView 1,5
        Return 0
    End Method

As far as the coding goes, that was it. However nothing was yet displaying in the game and I had a few false starts with the IDs I needed to enter. Changing the interstitial to a test id temporarily was showing that my code was ok. Then the final things I did:

release the game
On the Admob Site added a Payment Method
linked the Play Store version of the game within the admob site. (I think that was under App Settings which allowed the Play Store to be searched and the game located.)

To test I downloaded the app from the Play Store and banners and Interstitials were now working:

Hope this helps, if I've got anything wrong (already!) let me know and I'll update this.




CX Code Contributor
3rd Party Tool Dev
Jun 26, 2017
This is great stuff! Thanks for investing the time to write this HowTo Article.


Active member
3rd Party Module Dev
Tutorial Author
Jan 2, 2020
I was just about too look into interstitials and this will help a lot! Thanks
Top Bottom