with revoked permission android.permission.CAMERA

仓廪实则知礼节,衣食足则知荣辱。这篇文章主要讲述with revoked permission android.permission.CAMERA相关的知识,希望能为你提供帮助。
1,刚出现这样的问题我是直接把 CAMERA 移除掉
2.第一步判断时候授权。

if (Build.VERSION.SDK_INT > = 23) {
int checkCallPhonePermission = ContextCompat.checkSelfPermission(AppointmentDetailActivity.this, Manifest.permission.CAMERA);
if(checkCallPhonePermission != PackageManager.PERMISSION_GRANTED){
ActivityCompat.requestPermissions(AppointmentDetailActivity.this,new String[]{Manifest.permission.CAMERA},OPEN_CANMER);
return;
}else{
showCamera();
}
} else {
showCamera();
}

【with revoked permission android.permission.CAMERA】第二步 接收返回的结果。
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
switch (requestCode) {
case OPEN_CANMER:
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
showCamera();
} else {
Toast.makeText(AppointmentDetailActivity.this, "相机权限禁用了。请务必开启相机权", Toast.LENGTH_SHORT).show();
}
break;
default:
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
}

 

























    推荐阅读