标签:.sh oid int static length pac protected sre ted
/*// 新增 private static final int MY_PERMISSIONS_REQUEST_CALL_CAMERA = 1;//请求码,自己定义 // 新增Android6.0 权限检查 @Override protected void onStart() { super.onStart(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) { // 如果没有授权,则请求授权 ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA}, MY_PERMISSIONS_REQUEST_CALL_CAMERA); } else { // 有授权,直接开启摄像头 } } } // 新增Android6.0 权限检查 @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { // 判断请求码 if (requestCode == MY_PERMISSIONS_REQUEST_CALL_CAMERA) { //grantResults授权结果 if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { // 成功,开启摄像头 // callCamera(); } else { // 授权失败 Toast.makeText(CaptureActivity.this, "Permission Denied", Toast.LENGTH_SHORT).show(); Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); intent.setData(Uri.parse("package:" + CaptureActivity.this.getPackageName())); CaptureActivity.this.startActivityForResult(intent, 1028); this.finish(); } return; } super.onRequestPermissionsResult(requestCode, permissions, grantResults); } // 新增*/
标签:.sh oid int static length pac protected sre ted
原文地址:http://www.cnblogs.com/H-BolinBlog/p/6979357.html