public static SAVerifyInstall getInstance() { if (sharedInstance == null) { GameObject obj = new GameObject(); sharedInstance = obj.AddComponent <SAVerifyInstall> (); sharedInstance.name = "SAVerifyInstall"; DontDestroyOnLoad(sharedInstance); } return(sharedInstance); }
public void handleInstall(Action <bool> value) { // get the callback installCallback = value != null ? value : installCallback; #if (UNITY_IPHONE && !UNITY_EDITOR) SAVerifyInstall.SuperAwesomeAdvertiserUnitySAVerifyInstall(); #elif (UNITY_ANDROID && !UNITY_EDITOR) var unityClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); var context = unityClass.GetStatic <AndroidJavaObject> ("currentActivity"); context.Call("runOnUiThread", new AndroidJavaRunnable(() => { var saplugin = new AndroidJavaClass("tv.superawesome.plugins.advertiser.unity.SAdvUnityVerifyInstall"); saplugin.CallStatic("SuperAwesomeAdvertiserUnitySAVerifyInstall", context); })); #else Debug.Log("Handle CPI"); #endif }
// Use this for initialization void Start() { SAVerifyInstall.getInstance().handleInstall((success) => { Debug.Log("Handled install " + success); }); }