Scoped storage
Since Android 10 and with further updates in Android 11, the notion of scoped storage was introduced. The main idea behind this is to allow apps to gain more control of their files in external storage and prevent other apps from accessing these files.
The consequences of this mean that READ_EXTERNAL_STORAGE
and WRITE_EXTERNAL_STORAGE
will only apply to files a user interacts with (such as media files). This discourages apps from creating their own directories in external storage, instead sticking with the one already provided to them through Context.getExternalFilesDir
.
FileProviders and the SAF are a good way of making your app comply with scoped storage practices, with one allowing the app to use Context.getExternalFilesDir
and the other using the built-in File Explorer app, which will now avoid files from other applications in the Android/data
and Android/obb
folders in external storage.
Camera and media storage
Android offers a variety of ways to interact...