|  |  |  | 
|---|
|  |  |  | public void requestPermissions(Activity activity) { | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | // check权限 | 
|---|
|  |  |  | if (!hasPermissions(activity)) { | 
|---|
|  |  |  | // 没有则申请权限 | 
|---|
|  |  |  | ActivityCompat.requestPermissions(activity, new String[]{ | 
|---|
|  |  |  | Manifest.permission.READ_PHONE_STATE, Manifest.permission.WRITE_EXTERNAL_STORAGE}, RequestCode.QUICK); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | QuickSdkMgr.I.register(PlatformDiff.I.platformProductCode(), PlatformDiff.I.platformProductKey()); | 
|---|
|  |  |  | QuickSdkMgr.I.init(activity); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //            if (!hasPermissions(activity)) { | 
|---|
|  |  |  | //                // 没有则申请权限 | 
|---|
|  |  |  | //                ActivityCompat.requestPermissions(activity, new String[]{ | 
|---|
|  |  |  | //                        Manifest.permission.READ_PHONE_STATE, Manifest.permission.WRITE_EXTERNAL_STORAGE}, RequestCode.QUICK); | 
|---|
|  |  |  | //            } else { | 
|---|
|  |  |  | //                QuickSdkMgr.I.register(PlatformDiff.I.platformProductCode(), PlatformDiff.I.platformProductKey()); | 
|---|
|  |  |  | //                QuickSdkMgr.I.init(activity); | 
|---|
|  |  |  | //            } | 
|---|
|  |  |  | LogUtil.i("requestPermissions","x7申请权限,游戏直接启动初始化"); | 
|---|
|  |  |  | 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.READ_PHONE_STATE, Manifest.permission.WRITE_EXTERNAL_STORAGE}, RequestCode.QUICK); | 
|---|
|  |  |  | //            ActivityCompat.requestPermissions(activity, new String[]{ | 
|---|
|  |  |  | //                    Manifest.permission.READ_PHONE_STATE, Manifest.permission.WRITE_EXTERNAL_STORAGE}, RequestCode.QUICK); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void onRequestPermissionsResult(Activity activity, int requestCode, int[] grantResults) { | 
|---|
|  |  |  | LogUtil.i("onRequestPermissionsResult",String.format("%d-%d", requestCode, grantResults[0])); | 
|---|
|  |  |  | if (requestCode != RequestCode.QUICK) return; | 
|---|
|  |  |  | 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(); | 
|---|
|  |  |  | //        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(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void onActivityResult(Activity activity, int requestCode) { | 
|---|