forked from Writand/writand
1 KiB
1 KiB
Documentation for permissions
This file explains how to request permissions and how to check if the app has them.
Manage all files
This permission allows the application to work with the shared storage (normal user storage) without general limitations except for sdcard/android/ and storage/android/ and all subdirectories. All other directories can be accessed using normal file paths using the java.io.file classes and related.
Invoking the request
we need:
ACTION_MANAGE_ALL_APP_FILES_ACCESS_PERMISSION // (String)
to invoke the intent. We can invoke it as follows:
fun requestStoragePermission() {
val launcher = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) {
val result = Environment.isExternalStorageManager()
}
val intent = Intent(EXTERNAL_STORAGE_PERMISSION, Uri.parse("package:$packageName"))
launcher.launch(intent)
}
The result received from this activity is useless. It's only needed to know when the user has exited the activity.