简体   繁体   中英

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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