#Region Project Attributes
#ApplicationLabel: Admob Interstitial Example
#VersionCode: 2
#VersionName: 2.0
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#AdditionalRes: C:\Android\extras\google\google_play_services\libproject\google-play-services_lib\res, com.google.android.gms
#End Region
'admob interstitial library example
'for use with Google Play services library
'Written by: Jack Cole
'Mindware Consulting, Inc.
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim mwAdInterstitial As mwAdmobInterstitial
Dim Button1 As Button
Dim Label2 As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
mwAdInterstitial.Initialize("mwadi","ca-app-pub-........")
mwAdInterstitial.LoadAd
Activity.LoadLayout("1")
Label2.Text="Attempting to load ad... Please wait."
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub mwadi_AdClosed
Label2.Text="Ad dismissed by user."
Button1.Text="Load Ad"
'you can call LoadAd again here to queue the next ad
End Sub
Sub mwadi_AdOpened
Log("ad opened")
End Sub
Sub mwadi_AdLoaded
Log("ad loaded")
Button1.Text="Show Ad"
Label2.Text="Ad loaded - Click Show Ad to Display"
End Sub
Sub mwadi_AdFailedToLoad (ErrorMessage As String)
Label2.Text="Ad failed to load with error code: " & ErrorMessage
Log("failed to load ad: " & ErrorMessage)
End Sub
Sub Button1_Click
If mwAdInterstitial.Status=mwAdInterstitial.Status_AdReadyToShow Then mwAdInterstitial.Show
If mwAdInterstitial.Status=mwAdInterstitial.Status_Dismissed Then
Label2.Text="Attempting to load ad... Please wait."
mwAdInterstitial.LoadAd
End If
End Sub