Looking to create wrapper for the following SDK calls:
1) HeyzapLib.load(this);
Instructions say...
The load function takes one argument, which must be a Context object. It does not modify the context object, so in most cases you will pass in either this or this.getContext().
2) HeyzapLib.checkin(this, "I beat the monster on level 2!");
-------------------------------------
The first call request for "context" object, but maybe I am sending the wrong context object.
When calling HeyzapLib.load, nothing happens but a form is suppose to load.
When calling HeyzapLib.checkin, I get ClassException: android.app.Application cannot be cast to android.app,Activity
My wrapper code is here...
1) HeyzapLib.load(this);
Instructions say...
The load function takes one argument, which must be a Context object. It does not modify the context object, so in most cases you will pass in either this or this.getContext().
2) HeyzapLib.checkin(this, "I beat the monster on level 2!");
-------------------------------------
The first call request for "context" object, but maybe I am sending the wrong context object.
When calling HeyzapLib.load, nothing happens but a form is suppose to load.
When calling HeyzapLib.checkin, I get ClassException: android.app.Application cannot be cast to android.app,Activity
My wrapper code is here...
B4X:
package com.leaderboard;
import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.BA.DependsOn;
import anywheresoftware.b4a.BA.Permissions;
import anywheresoftware.b4a.BA.ShortName;
import anywheresoftware.b4a.BA.Version;
import com.heyzap.sdk.HeyzapLib;
@DependsOn(values={"heyzapsdk"})
@Permissions(values={"android.permission.INTERNET"})
@ShortName("HZ_LeaderBoard")
@Version(1.0f)
public class leaderboardclass {
public void HzRegister(final BA ba){
HeyzapLib.load(BA.applicationContext.getApplicationContext());
}
public void HzCheckin(final BA ba, String Msg){
HeyzapLib.checkin(BA.applicationContext.getApplicationContext(), Msg);
}
public void HzSubmitscore(String Score, String ScoreMsg, String LevelId){
HeyzapLib.submitScore(BA.applicationContext.getApplicationContext(), Score, ScoreMsg, LevelId);
}
public void HzShowLeaderBoard(){
HeyzapLib.showLeaderboards(BA.applicationContext.getApplicationContext());
}
}
Last edited: