val intent = Intent(Intent.ACTION_OPEN_DOCUMENT_TREE).apply {
putExtra("android.content.extra.SHOW_ADVANCED", true)
putExtra("android.content.extra.FANCY", true)
putExtra("android.content.extra.SHOW_FILESIZE", true)
}
...
intent.putExtra(
DocumentsContract.EXTRA_INITIAL_URI,
uri // for example for /emulated/0/Audiobooks
)
But a user can select a different path in the file manager. How can I block it to one specific path?
I just need to get permission for the specific and the exact folder, a user should have a choice to select others...
So basically he can select other path instead of Audiobooks and press "Use this folder" button
How can I block it to one specific path?
That is not possible, sorry. It is the user's device, and the user's content. The user gets to decide what tree to share with your app (if any).