Konubinix' opinionated web of thoughts

Android 11 Scoped Storage

Fleeting

Android 11 storage FAQ

First introduced in Android 10, scoped storage is designed to protect app and user data and reduce file clutter

https://medium.com/androiddevelopers/android-11-storage-faq-78cefea52b7c

no longer use the ACTION_OPEN_DOCUMENT_TREE intent action to request access to the following directories:

The root directory of the internal storage volume. The root directory of each SD card volume that the device manufacturer considers to be reliable, regardless of whether the card is emulated or removable. A reliable volume is one that an app can successfully access most of the time. The Download directory.

https://developer.android.com/about/versions/11/privacy/storage

your app targets Android 11, both the WRITE_EXTERNAL_STORAGE permission and the WRITE_MEDIA_STORAGE privileged permission no longer provide any additional access

https://developer.android.com/about/versions/11/privacy/storage

some apps have a core use case that requires broad access of files on a device, but cannot do so efficiently using the privacy-friendly storage best practices. Android provides a special app access called All files access for these situations. To learn more, see the guide on how to manage all files on a storage device.

https://developer.android.com/about/versions/11/privacy/storage

some apps have a core use case that requires broad access to files on a device, but can’t access them efficiently using the privacy-friendly storage best practices. Android provides a special app access called all-files access for these situations.

https://developer.android.com/training/data-storage/manage-all-files

example, an anti-virus app’s primary use case might require regular scanning of many files across different directories. If this scanning requires repeated user interactions to select directories using the system file picker, it provides a poor user experience

https://developer.android.com/training/data-storage/manage-all-files

request all-files access from the user by doing the following:

Declare the MANAGE_EXTERNAL_STORAGE permission in the manifest. Use the ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION intent action to direct users to a system settings page where they can enable the following option for your app: Allow access to manage all files.

To determine whether your app has been granted the MANAGE_EXTERNAL_STORAGE permission, call Environment.isExternalStorageManager().

https://developer.android.com/training/data-storage/manage-all-files

MANAGE_EXTERNAL_STORAGE permission grants the following:

Read and write access to all files within shared storage.

https://developer.android.com/training/data-storage/manage-all-files

Access to the root directory of both the USB on-the-go (OTG) drive and the SD card

https://developer.android.com/training/data-storage/manage-all-files

Notes linking here