am targeting my Android app for Android 13 (API 33) The WRITE_EXTERNAL_STORAGE permission seems to be working fine below API 33 i.e. Android 12 and less but the runtime permission popup for WRITE_EXTERNAL_STORAGE won't appear when running the app on Android 13. My Android app creates one keystore file in app's private storage. The behaviour changes for Android 13 mention this: If your app targets Android 13, you must request one or more new permissions instead of the READ_EXTERNAL_STORAGE. The new permissions are: Images and photos: READ_MEDIA_IMAGES Videos: READ_MEDIA_VIDEO Audio Audio files: READ_MEDIA_AUDIO I didn't find any information about this in the official documentation. The documentation is focusing on media files only without any word about other file types. #62697
Replies: 1 comment
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Select Topic Area
Question
Body
TLDR: You don't.
From Google's official documentation:
"If your app targets Android 11, both the WRITE_EXTERNAL_STORAGE permission and the WRITE_MEDIA_STORAGE privileged permission no longer provide any additional access."
So in effect, if you were to request WRITE_EXTERNAL_STORAGE on Android 11 or later, you would be requesting nothing. This is the whole point of Android's migration to scoped storage, which effectively prevents apps from reading or writing to the storage directories of other apps UNLESS they are accessing specific file types (e.g. media, using the permissions you mentioned) or are granted special file manager permissions by Google themselves. For more insight into scoped storage, see this well written article, but TLDR security and leftover files from app uninstalls were the big reasons Google did this.
So if you really want to write files, either make sure you're only writing to your app's designated storage directories, in which case you won't need any permissions at all, or if you really need to write to a directory your app doesn't own get that file manager permission from Google (how to get that permission)
Beta Was this translation helpful? Give feedback.
All reactions