#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
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.
Private hms As HMSManager
Dim iad As JavaObject
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("tt")
hms.Initialize
hms.EnableLogs
Dim banner As B4XView = hms.CreateBannerAd("testw6vs28auh3", "BANNER_SIZE_320_50", Me, "Banner")
Activity.AddView(banner, Activity.Width / 2 - 320dip / 2, Activity.Height - 50dip, 320dip, 50dip)
hms.LoadBannerAd(banner, hms.CreateRequestBuilder)
iad = hms.CreateInterstitialAd("testb4znbuh3n2", Me, "Interstitial") 'iad is a global JavaObject variable
hms.LoadInterstitialAd(iad, hms.CreateRequestBuilder)
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Banner_AdFailed (ErrorCode As Int)
Log("Failed: " & ErrorCode)
End Sub
Sub Banner_AdLoaded
Log("AdLoaded")
End Sub
Sub Banner_AdOpened
Log("AdOpened")
End Sub
Sub Interstitial_AdFailed (ErrorCode As Int)
Log("Failed: " & ErrorCode)
End Sub
Sub Interstitial_AdLoaded
Log("AdLoaded")
End Sub
Sub Button1_Click
iad.RunMethod("show", Null)
End Sub