简体   繁体   English

Android 从代码中撤销权限

[英]Android revoke permissions from Code

My request may seems strange, but I need to reset the permissions from the code.我的请求可能看起来很奇怪,但我需要从代码中重置权限。 I ask the permissions like that :我问这样的权限:

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

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

How can I revoke that permission once the user granted it?一旦用户授予该权限,我如何撤销该权限?

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM