#If TARGET<>"android" And TARGET<>"ios"
#Error "Admob is only supported on Android and iOS targets"
#End
#ANDROID_LOGCAT_OPTION="-s [Cerberus]:E"
Import mojo
Import brl.admob
' FIND THESE STRINGS BY JUST FOLLOWING THE SCREENSHOTS :
' APP-ID : ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy (you see this on screenshot 4, the top ID with an Android icon, it's common for all ads)
' AD-ID (FULLSCREEN-AD) : ca-app-pub-xxxxxxxxxxxxxxxx/aaaaaaaaaa ' (you see this on screenshot 4, the bottom)
' AD-ID (BANNER-AD) : ca-app-pub-xxxxxxxxxxxxxxxx/bbbbbbbbbb ' (you see this on screenshot 4, the bottom, after done the same for the other ad)
' WRITE YOUR APP ID HERE (don't forget to add an additional ~ because how strings manages special symbols)
#ADMOB_ANDROID_ADS_APPID = "ca-app-pub-xxxxxxxxxxxxxxxx~~yyyyyyyyyy"
' WRITE YOUR BANNER-AD ID HERE
#ADMOB_PUBLISHER_ID = "ca-app-pub-xxxxxxxxxxxxxxxx/aaaaaaaaaa"
Class MyApp Extends App
Field admob:Admob
Field interstitialAdmob:AdmobInterstitial
Field layout:=1
Field state:=1
Method OnCreate()
admob=Admob.GetAdmob()
admob.ShowAdView 1,layout
' WRITE YOUR INTERSITIAL-AD ID HERE
interstitialAdmob = AdmobInterstitial.GetAdmobInterstitial("ca-app-pub-xxxxxxxxxxxxxxxx/bbbbbbbbbb")
SetUpdateRate 60
End
Method OnUpdate()
If MouseHit( 0 )
If state = 3
admob.HideAdView
state+=1
Else If state = 1
layout+=1
If layout=7 layout=1
admob.ShowAdView 1,layout
state+=1
Else If state = 2
admob.HideAdView
interstitialAdmob.ShowAdViewInterstitial
state+=1
End
End
End
Method OnRender()
Local en:="disabled"
If state=2 en="enabled"
Cls
PushMatrix
Scale 2,2
DrawText "Click to toggle ads! ads are currently "+en,DeviceWidth/4,DeviceHeight/4,.5,.5
PopMatrix
End
End
Function Main()
New MyApp
End