In Android 11 targeting SDK 30, the files created into the shared folder with MediaStore are not retrieved when the app is reinstalled.
Android 11 cannot retrieve files create with MediaStore after the app re-installs
Asked Answered
That is expected behavior. What is your question? –
Calix
What do you consider to be 'the shared folder'? –
Accrue
@Calix I don't know if this behaviour should be considered the one expected because the owner of the file should be able to read the file created –
Heehaw
@Accrue the shared folder are Documents, Download, Pictures –
Heehaw
What do you mean with 'not retrieved'? I think they are still there. –
Accrue
@Accrue Yes, they are still there, but when I query the MediaStore with contentResolver query they are not retrieved –
Heehaw
That is normal on an Android 10 device as you will see only apps own files and some public media files. The owner is very important on Android 11 and at reinstall the app is not the owner anymore. If you want to use them again use saf. –
Accrue
"I don't know if this behaviour should be considered the one expected because the owner of the file should be able to read the file created" -- the owner of the file was uninstalled. From Android's standpoint, your fresh app install is not the owner. –
Calix
@Davide Murru, With shared folders as Pictures, Movies & Music, you can! I checked this on an Android 13. Even after a reinstall, I find them.
But don't miss to authorize respectively READ_MEDIA_IMAGES
, READ_MEDIA_VIDEO
& READ_MEDIA_AUDIO
permissions for each folders you use.
© 2022 - 2024 — McMap. All rights reserved.