简体   繁体   中英

Android11 : how to check the value of MANAGE_ALL_FILES_ACCESS_PERMISSION in settings?

My targetSdkVersion is 30 and I need to use every function of file manager, so I add MANAGE_EXTERNAL_STORAGE and open SystemSetting to get the permission. But, I need to check the value of MANAGE_ALL_FILES_ACCESS_PERMISSION in settings whether On or Off.

How can I check the value of the permission?

AndroidManifest.xml

<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />

MainActivity.java

boolean bAlreadyHavePermission;
                
bAlreadyHavePermission = ?;
                
if(bAlreadyHavePermission == false) {
    Intent intent = new Intent(android.provider.Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION);
    startActivity(intent);
}

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