client_Hale
2018-09-07 0a013f5f2b29c15531b6f2216f2c4918b317b902
Project/app/src/main/java/com/secondworld/univeralsdk/MainActivity.java
@@ -19,7 +19,7 @@
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;
@@ -37,16 +37,22 @@
        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
@@ -61,7 +67,7 @@
    @Override
    protected void onStart()
    {
        H2EngineSDK.onStart();
        H2EngineSDK.onStart(this);
        super.onStart();
        LogUtil.i(TAG, "onStart");
@@ -70,7 +76,8 @@
    @Override
    protected void onStop()
    {
        H2EngineSDK.onStop();
        isForeground = false;
        H2EngineSDK.onStop(this);
        super.onStop();
        LogUtil.i(TAG, "onStop");
@@ -79,7 +86,8 @@
    @Override
    protected void onResume()
    {
        H2EngineSDK.onResume();
        isForeground = true;
        H2EngineSDK.onResume(this);
        super.onResume();
        LogUtil.i(TAG, "onResume");
@@ -89,10 +97,10 @@
                                              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("应用没有存储读取权限,点击确定至设置中开启,否则无法继续游戏.")
@@ -132,7 +140,7 @@
    @Override
    protected void onPause()
    {
        H2EngineSDK.onPause();
        H2EngineSDK.onPause(this);
        super.onPause();
        LogUtil.i(TAG, "onPause");
@@ -141,7 +149,7 @@
    @Override
    protected void onDestroy()
    {
        H2EngineSDK.onDestroy();
        H2EngineSDK.onDestroy(this);
        super.onDestroy();
        LogUtil.i(TAG, "onDestroy");
@@ -150,7 +158,7 @@
    @Override
    protected void onRestart()
    {
        H2EngineSDK.onRestart();
        H2EngineSDK.onRestart(this);
        super.onRestart();
        LogUtil.i(TAG, "onRestart");