Interface Description:
Before accessing the Android SDK, you need to initialize the SDK first, and only after the initialization is completed can you use all the functions of the SDK with the background system. Generally, SDK initialization is done after entering the game.
Method definition: void init()
Example:
//Initialization
public void Init() {
using (AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer")) {
using (AndroidJavaObject jo = jc.GetStatic("currentActivity")) {
jo.Call("init");
}
}
}Interface Description:
When the SDK is called to initialize the interface, a callback message is sent to the appropriate method.
Method Definition:void onInitFinish(string message)
Parameter Description:
message is the result of the initialization. success=success; fail=failure
Example:
void onInitFinish(string message) {
Debug.Log("===onInitFinish : " + message);
if (message == "success") {
Debug.Log("Initialization success");
}
else {
Debug.Log("Initialization failure");
}
}