| package com.secondworld.sdk; | 
|   | 
| import android.app.Application; | 
| import android.content.Intent; | 
| import android.content.pm.PackageManager; | 
| import android.os.Handler; | 
|   | 
| import com.unity3d.player.UnityPlayer; | 
|   | 
| public class GameAppProxy { | 
|   | 
|     public static Application app; | 
|   | 
|     public static String appId = ""; | 
|   | 
|     public static boolean isDemo = false; | 
|   | 
|     public static void create(Application app, PlatformDiff diff) { | 
|         PlatformDiff.I = diff; | 
|         GameAppProxy.app = app; | 
|         UnityMsgHandler.initCommandMap(); | 
|     } | 
|   | 
|     public static void appExit() { | 
|         new Handler().postDelayed(() -> { | 
|             android.os.Process.killProcess(android.os.Process.myPid());// 杀进程 | 
|         }, 1000); | 
|         if (UnityPlayer.currentActivity != null) | 
|             UnityPlayer.currentActivity.finish(); | 
|     } | 
|   | 
|     public static void restartApp() { | 
|         new Handler().postDelayed(() -> { | 
|             String _pn = app.getPackageName(); | 
|             PackageManager packageManager = app.getPackageManager(); | 
|             Intent intent = packageManager.getLaunchIntentForPackage(_pn); | 
|             intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); | 
|             app.startActivity(intent); | 
|         }, 1000); | 
|         if (UnityPlayer.currentActivity != null) | 
|             UnityPlayer.currentActivity.finish(); | 
|         android.os.Process.killProcess(android.os.Process.myPid());// 杀进程 | 
|     } | 
|   | 
|     //是否位demo | 
|     public static boolean isDemo() { | 
|         return isDemo; | 
|     } | 
|   | 
| } |