with revoked permission android.permission.CAMERA

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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();
}

第二步 接收返回的结果。

@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);
}
}
 























以上是关于with revoked permission android.permission.CAMERA的主要内容,如果未能解决你的问题,请参考以下文章

Permissible Privileges for GRANT and REVOKE

如何使用 adb grant 或 adb revoke?

使用 Grant 和 Revoke 时遇到问题

区块链最新论文速递NeuChain: A Fast Permissioned Blockchain System with Deterministic Ordering

区块链最新论文速递NeuChain: A Fast Permissioned Blockchain System with Deterministic Ordering

Permission denied Command PhaseScriptExecution failed with a nonzero exit code