Android 撤消对代码的权限

Android revoke permissions from Code

我的请求可能看起来很奇怪,但我需要从代码中重置权限。 我问这样的权限:

if (ContextCompat.checkSelfPermission(getApplicationContext(),
            Manifest.permission.CAMERA)
            != PackageManager.PERMISSION_GRANTED) {

        ActivityCompat.requestPermissions(this,
                new String[]{Manifest.permission.CAMERA},
                MY_PERMISSIONS_REQUEST_CAMERA);
}

一旦用户授予权限,我如何撤销该权限?

您不能出于同样的原因不能授予它们 - 它们必须始终处于用户控制之下。