Hi all.
I'm trying to use the startapp sdk and I'm having some difficulties.
the problem is in adding the interstitial callback
here's the page that talks about it.
support.startapp.com
here's the initial SDK tutorial, using the .jar file
and here is an example of a java app.
github.com
Here's what I've done so far.
The error log
what can i be doing wrong? as the documentation says I must pass the listener on loadAd
any help is welcome!
thanks
I'm trying to use the startapp sdk and I'm having some difficulties.
the problem is in adding the interstitial callback
here's the page that talks about it.
Advanced Usage
This section describes advanced usage and personal customization options and is not mandatory for the integration. Interstitial Ads Implement interstitial ads with objects for gaining more control ...
here's the initial SDK tutorial, using the .jar file
and here is an example of a java app.
StartApp_InApp_SDK_Example/app/src/main/java/com/example/app/MainActivity.java at master · StartApp-SDK/StartApp_InApp_SDK_Example
StartApp InApp Android SDK Example Project. Contribute to StartApp-SDK/StartApp_InApp_SDK_Example development by creating an account on GitHub.
Here's what I've done so far.
B4X:
Sub Init_StartApp
Private ctxt As JavaObject
ctxt.InitializeContext
'INIT SDK
Private StartAppSDK As JavaObject
StartAppSDK.InitializeStatic("com.startapp.sdk.adsbase.StartAppSDK")
StartAppSDK.RunMethod("init", Array(ctxt,startAppKey,True))
'SET TEST MODE
StartAppSDK.RunMethod("setTestAdsEnabled", Array(True))
'INIT ADS
Private StartAppAd As JavaObject
StartAppAd.InitializeStatic("com.startapp.sdk.adsbase.StartAppAd")
'INIT LISTENER
Dim AdListenerIntersticial As Object = StartAppAd.CreateEventFromUI("com.startapp.sdk.adsbase.adlisteners.AdEventListener", "AdListenerIntersticial", Null)
'CALL LOAD AD WITH LISTENER
StartAppAd.RunMethod("loadAd", Array(AdListenerIntersticial)) 'CRASH HERE
End Sub
The error log
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Error occurred on line: 80 (Main)
java.lang.IllegalArgumentException: Expected receiver of type com.startapp.sdk.adsbase.StartAppAd, but got java.lang.Class<com.startapp.sdk.adsbase.StartAppAd>
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:131)
at teste.app.iddouglasqw.main._init_startapp(main.java:437)
at teste.app.iddouglasqw.main._activity_create(main.java:393)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at teste.app.iddouglasqw.main.afterFirstLayout(main.java:105)
at teste.app.iddouglasqw.main.access$000(main.java:17)
at teste.app.iddouglasqw.main$WaitForLayout.run(main.java:83)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:201)
at android.app.ActivityThread.main(ActivityThread.java:6810)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
** Activity (main) Resume **
what can i be doing wrong? as the documentation says I must pass the listener on loadAd
Java:
startAppAd.loadAd (new AdEventListener () {
@Override
public void onReceiveAd (Ad ad) {
}
@Override
public void onFailedToReceiveAd (Ad ad) {
}
});
any help is welcome!
thanks