Mobile ScreenShot Android 11 How to create a folder on the root directory (External Storage) in Android 11 or Android R (Kotlin) Currently able to create an App folder in Public Directory e.g DIRECTORY_DOWNLOADS, but not able to create an App folder in File Explorer on the root. What would be the solution?
val relativePath = "${DIRECTORY_DOWNLOADS}${File.separator}${"AppName"}"
How to create a folder on the root directory (External Storage) in Android 11 or Android R (Kotlin)
That is no longer supported.
What would be the solution ?
Use ACTION_OPEN_DOCUMENT_TREE / ActivityResultContracts.OpenDocumentTree and let the user decide where on the user's device (or the user's chosen cloud storage provider) that the user would like for you to store the user's content. You can use takePersistableUriPermission() to get durable access to this tree, so you only need to prompt the user once.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With