|  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void requestPermissions(Activity activity) { | 
 |  |  | //        try { | 
 |  |  | //            // check权限 | 
 |  |  | //            if (!hasPermissions(activity)) { | 
 |  |  | //                // 没有则申请权限 | 
 |  |  | //                ActivityCompat.requestPermissions(activity, new String[]{ | 
 |  |  | //                        Manifest.permission.WRITE_EXTERNAL_STORAGE}, RequestCode.QUICK); | 
 |  |  | //            } else { | 
 |  |  | //                QuickSdkMgr.I.register(PlatformDiff.I.platformProductCode(), PlatformDiff.I.platformProductKey()); | 
 |  |  | //                QuickSdkMgr.I.init(activity); | 
 |  |  | //            } | 
 |  |  | //        } catch (Exception e) { | 
 |  |  | //            //QuickSdkMgr.I.init(activity); | 
 |  |  | //            ActivityCompat.requestPermissions(activity, new String[]{ | 
 |  |  | //                    Manifest.permission.WRITE_EXTERNAL_STORAGE}, RequestCode.QUICK); | 
 |  |  | //        } | 
 |  |  | //        ActivityCompat.requestPermissions(activity, new String[]{ | 
 |  |  | //                        Manifest.permission.WRITE_EXTERNAL_STORAGE}, RequestCode.QUICK); | 
 |  |  |  | 
 |  |  |         try { | 
 |  |  |             ActivityCompat.requestPermissions(activity, new String[]{ | 
 |  |  |             if (!hasPermissions(activity)) { | 
 |  |  |                 ActivityCompat.requestPermissions(activity, new String[]{ | 
 |  |  |                         Manifest.permission.WRITE_EXTERNAL_STORAGE}, RequestCode.QUICK); | 
 |  |  |             QuickSdkMgr.I.register(PlatformDiff.I.platformProductCode(), PlatformDiff.I.platformProductKey()); | 
 |  |  |             QuickSdkMgr.I.init(activity); | 
 |  |  |             } | 
 |  |  |             else | 
 |  |  |             { | 
 |  |  |                 QuickSdkMgr.I.register(PlatformDiff.I.platformProductCode(), PlatformDiff.I.platformProductKey()); | 
 |  |  |                 QuickSdkMgr.I.init(activity); | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |         } | 
 |  |  |         catch (Exception e) { | 
 |  |  |             LogUtil.i("SdkManager", "requestPermissions 初始化SDK失败"); | 
 |  |  | 
 |  |  |  | 
 |  |  |     public void onRequestPermissionsResult(Activity activity, int requestCode, int[] grantResults) { | 
 |  |  |         if (requestCode != RequestCode.QUICK) return; | 
 |  |  |         if (hasPermissions(activity)) | 
 |  |  |         { | 
 |  |  |             LogUtil.i("SdkManager", "onRequestPermissionsResult 申请成功"); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  | //        if (hasPermissions(activity)) { | 
 |  |  | //            //申请成功 | 
 |  |  | //            QuickSdkMgr.I.register(PlatformDiff.I.platformProductCode(), PlatformDiff.I.platformProductKey()); | 
 |  |  | //            QuickSdkMgr.I.init(activity); | 
 |  |  | //            return; | 
 |  |  | //        } | 
 |  |  | //        final AlertDialog.Builder normalDialog = new AlertDialog.Builder(activity); | 
 |  |  | //        normalDialog.setTitle("权限设置"); | 
 |  |  | //        normalDialog.setMessage("游戏需要部分权限才能正常运行,请前往设置中打开电话权限与存储权限"); | 
 |  |  | //        normalDialog.setPositiveButton("前往设置", new DialogInterface.OnClickListener() { | 
 |  |  | //            @Override | 
 |  |  | //            public void onClick(DialogInterface dialog, int which) { | 
 |  |  | //                Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); | 
 |  |  | //                Uri uri = Uri.fromParts("package", activity.getPackageName(), null); | 
 |  |  | //                intent.setData(uri); | 
 |  |  | //                activity.startActivityForResult(intent, REQUEST_RECORD_PERMISSION_SETTING); | 
 |  |  | //                dialog.dismiss(); | 
 |  |  | //            } | 
 |  |  | //        }); | 
 |  |  | //        normalDialog.setNegativeButton("退出", new DialogInterface.OnClickListener() { | 
 |  |  | //            @Override | 
 |  |  | //            public void onClick(DialogInterface dialog, int which) { | 
 |  |  | //                GameAppProxy.appExit(); | 
 |  |  | //            } | 
 |  |  | //        }); | 
 |  |  | //        // 显示 | 
 |  |  | //        normalDialog.show(); | 
 |  |  |         //1768渠道一定需要权限 | 
 |  |  |         if (hasPermissions(activity)) { | 
 |  |  |             LogUtil.i("SdkManager", "onRequestPermissionsResult 申请成功"); | 
 |  |  |             //申请成功 | 
 |  |  |             QuickSdkMgr.I.register(PlatformDiff.I.platformProductCode(), PlatformDiff.I.platformProductKey()); | 
 |  |  |             QuickSdkMgr.I.init(activity); | 
 |  |  |             return; | 
 |  |  |         } | 
 |  |  |         final AlertDialog.Builder normalDialog = new AlertDialog.Builder(activity); | 
 |  |  |         normalDialog.setTitle("权限设置"); | 
 |  |  |         normalDialog.setMessage("游戏需要部分权限才能正常运行,请前往设置中打开存储权限"); | 
 |  |  |         normalDialog.setPositiveButton("前往设置", new DialogInterface.OnClickListener() { | 
 |  |  |             @Override | 
 |  |  |             public void onClick(DialogInterface dialog, int which) { | 
 |  |  |                 Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); | 
 |  |  |                 Uri uri = Uri.fromParts("package", activity.getPackageName(), null); | 
 |  |  |                 intent.setData(uri); | 
 |  |  |                 activity.startActivityForResult(intent, REQUEST_RECORD_PERMISSION_SETTING); | 
 |  |  |                 dialog.dismiss(); | 
 |  |  |             } | 
 |  |  |         }); | 
 |  |  |         normalDialog.setNegativeButton("退出", new DialogInterface.OnClickListener() { | 
 |  |  |             @Override | 
 |  |  |             public void onClick(DialogInterface dialog, int which) { | 
 |  |  |                 GameAppProxy.appExit(); | 
 |  |  |             } | 
 |  |  |         }); | 
 |  |  |         // 显示 | 
 |  |  |         normalDialog.show(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public void onActivityResult(Activity activity, int requestCode) { | 
 |  |  | 
 |  |  |             @Override | 
 |  |  |             public void onSuccess() { | 
 |  |  |                 //退出成功,游戏在此做自身的退出逻辑处理 | 
 |  |  |                 UnityMsgHandler.sendMessageToUnity(CodeA2U.ExitGame); | 
 |  |  |                 //UnityMsgHandler.sendMessageToUnity(CodeA2U.ExitGame); | 
 |  |  |                 if (GameActivityProxy.I.activity == null) | 
 |  |  |                 { | 
 |  |  |                     UnityMsgHandler.sendMessageToUnity(CodeA2U.ExitGame); | 
 |  |  |                     return; | 
 |  |  |                 } | 
 |  |  |                 LogUtil.i("SdkManager", "activity退出"); | 
 |  |  |                 GameActivityProxy.I.activity.finish(); | 
 |  |  |                 android.os.Process.killProcess(android.os.Process.myPid()); | 
 |  |  |                 System.exit(0); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             @Override |