using System.Collections; using System.Collections.Generic; using UnityEngine; public class ADSRemovePopup : PopupBase { public void ClickClose() { GameManager.Sound.PlaySFX(ESFXType.Button_Hit); GameManager.UI.HideTopPopup(); } public void ClickGameClose() { GameManager.Sound.PlaySFX(ESFXType.Button_Hit); RestartApplication(); //GameManager.BGDatabase.ReleaseHuntingUnlockImage(); //GameManager.Scene.LoadScene(ESceneType.Title); } public void RestartApplication() { #if UNITY_ANDROID && !UNITY_EDITOR using (var unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer")) { const int kIntent_FLAG_ACTIVITY_CLEAR_TASK = 0x00008000; const int kIntent_FLAG_ACTIVITY_NEW_TASK = 0x10000000; var currentActivity = unityPlayer.GetStatic("currentActivity"); var pm = currentActivity.Call("getPackageManager"); var intent = pm.Call("getLaunchIntentForPackage", Application.identifier); intent.Call("setFlags", kIntent_FLAG_ACTIVITY_NEW_TASK | kIntent_FLAG_ACTIVITY_CLEAR_TASK); currentActivity.Call("startActivity", intent); currentActivity.Call("finish"); var process = new AndroidJavaClass("android.os.Process"); int pid = process.CallStatic("myPid"); process.CallStatic("killProcess", pid); } #endif } }