to let the user choose a directory and get access to this directory. It works but unfortunately the access is only temporary when the user closes the app and opens the app again i need to open the directory picker again. Especially for development this is very unpleasent. Of course i could ask the user for MANAGE_EXTERNAL_STORAGE permission but Google do not want this anymore for normal apps. My app is just a video player. But i need access to the directory to load subtitle files.
Yes but in my observations this is only true for files not for directories. At least in my observations. Maybe i am doing something wrong. I also do not care about device reboot that is not important.
i
Ian Lake
11/26/2022, 12:49 AM
It also works for directories
yes black 1
t
Timo Drick
11/26/2022, 1:02 AM
Thank you for pointing me to the documentation i think i got it working 😄
🎉 1
Timo Drick
11/26/2022, 1:03 AM
But it looks like i have to call this
Copy code
val flags = Intent.FLAG_GRANT_READ_URI_PERMISSION
ctx.contentResolver.takePersistableUriPermission(uri, flags)
even if i do not care about reboots. But than it works when i restart the app.
Thank you very much