Open amrhossamdev opened 2 months ago
(just caught the issue link, great timing!)
READ_MEDIA_IMAGES
and READ_MEDIA_VIDEO
are not going to be sufficient for your intention
You want to look into ACTION_OPEN_DOCUMENT_TREE
to obtain permissions to write to a folder on external storage (incl. cloud providers).
Note that this uses a androidx.documentfile.provider.DocumentFile
, but this should be sufficient for writing backups.
https://developer.android.com/reference/android/content/Intent#ACTION_OPEN_DOCUMENT_TREE
Additional Reading
CommonsWare has a great series on the Android 10/11 storage changes:
https://commonsware.com/blog/2019/10/19/scoped-storage-stories-saf-basics.html
Also see:
Thanks for your help. I appreciate it!
Summary:
We got a report from a user with Android version
33
that he can't grant permissions for saving a backup in the storage, I started to investigate and I found that we use permissionsREAD_EXTERNAL_STORAGE
andWRITE_EXTERNAL_STORAGE
now replaced withREAD_MEDIA_IMAGES
andREAD_MEDIA_VIDEO
for higher android version fromAPI 33
and above. See android docsI tested this on my Android 13 emulator and can confirm it's broken.
Useful discussion/articles:
Steps to reproduce:
Expected behavior:
Dialog pop-up asking for the permissions
Observed behavior:
No dialog asking for permission
Device and Android version:
Android Version: 13 - API 33
Video
Screencast from 04-28-2024 11:35:15 PM.webm