| | |
| | | public class MainActivity extends UnityPlayerActivity |
| | | { |
| | | private static final String TAG = "MainActivity"; |
| | | |
| | | public static boolean isForeground = false; |
| | | // 启用6.0以上权限回调code |
| | | // private static final int CODE_REQUEST_PERMISSION = 1000; |
| | | |
| | |
| | | View unityView = mUnityPlayer.getView(); |
| | | _frameLayout.addView(unityView); |
| | | |
| | | H2EngineSDK.onCreate(savedInstanceState); |
| | | H2EngineSDK.onCreate(this, savedInstanceState); |
| | | } |
| | | |
| | | @Override |
| | | protected void onNewIntent(Intent intent) |
| | | { |
| | | H2EngineSDK.onNewIntent(intent); |
| | | |
| | | super.onNewIntent(intent); |
| | | H2EngineSDK.onNewIntent(this, intent); |
| | | LogUtil.i(TAG, "onNewIntent"); |
| | | } |
| | | |
| | | @Override |
| | | protected void onActivityResult(int requestCode, int resultCode, Intent data) |
| | | { |
| | | H2EngineSDK.onActivityResult(requestCode, resultCode, data, this); |
| | | super.onActivityResult(requestCode, resultCode, data); |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | protected void onStop() |
| | | { |
| | | isForeground = false; |
| | | H2EngineSDK.onStop(this); |
| | | |
| | | super.onStop(); |
| | |
| | | @Override |
| | | protected void onResume() |
| | | { |
| | | isForeground = true; |
| | | H2EngineSDK.onResume(this); |
| | | |
| | | super.onResume(); |
| | |
| | | Manifest.permission.WRITE_EXTERNAL_STORAGE, |
| | | Process.myPid(), Process.myUid(), |
| | | getPackageName()) != PackageManager.PERMISSION_GRANTED |
| | | || PermissionChecker.checkPermission(this, |
| | | Manifest.permission.READ_EXTERNAL_STORAGE, |
| | | Process.myPid(), Process.myUid(), |
| | | getPackageName()) != PackageManager.PERMISSION_GRANTED) |
| | | || PermissionChecker.checkPermission(this, |
| | | Manifest.permission.READ_EXTERNAL_STORAGE, |
| | | Process.myPid(), Process.myUid(), |
| | | getPackageName()) != PackageManager.PERMISSION_GRANTED) |
| | | { |
| | | new AlertDialog.Builder(this) |
| | | .setMessage("应用没有存储读取权限,点击确定至设置中开启,否则无法继续游戏.") |