#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName: 1.0.0
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#AdditionalJar: adcolony
#AdditionalJar: androidx.appcompat:appcompat
#AdditionalJar: com.google.android.gms:play-services-ads-identifier
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Private AdColony As JavaObject
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 appid As String = "app6e40d81b1cc84c4891"
Dim zoneid As String = "vz6c2d7e01d0f849cf9e"
Dim Button1 As Button
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("Layout1")
Log("start")
Activity.Color=Colors.Red
AdColony.InitializeStatic("com.adcolony.sdk.AdColony")
Dim ctxt As JavaObject
ctxt.InitializeContext
AdColony.RunMethod("configure", Array(ctxt, appid, Array As String(zoneid))) '<----------
Button1.Initialize("Button1")
Activity.AddView(Button1,10%x,50%y,80%x,12%y)
End Sub
Sub Button1_Click
RequestInterstitial
End Sub
Sub RequestInterstitial
Dim listener As JavaObject
listener.InitializeNewInstance(Application.PackageName & ".main$MyAdColonyInterstitialListener", Null)
AdColony.RunMethod("requestInterstitial", Array(zoneid, listener)) '<----------
End Sub
Sub AdColony_OnRequestFilled (Ad As Object)
Log("OnRequestFilled")
Log(Ad)
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
#if Java
import com.adcolony.sdk.*;
public static class MyAdColonyInterstitialListener extends AdColonyInterstitialListener {
public void onRequestFilled(AdColonyInterstitial ad) {
main.processBA.raiseEventFromUI(null, "adcolony_onrequestfilled", ad);
}
}
#End If