How to create a public folder/file in Android 10

后端 未结 2 423
有刺的猬
有刺的猬 2020-12-19 04:11

Android Api 29 has big changes regarding files and folders. I have not found a way so far to create a folder in the internal storage that is public visible. Every folder I

2条回答
  •  囚心锁ツ
    2020-12-19 04:44

    Starting from Android 10, you should use SAF, and let user choose the directory using ACTION_OPEN_DOCUMENT_TREE.

    If you need a simple example. You can find it here

    Alternatively, you could use requestLegacyExternalStorage = true in manifest when your app is not newly released. But, this is something that should not be used for future release, as this is a short-term solution provided by Google.

    Note: In future releases of Android, user will not be able to pick the whole external file directory and Downloads directory, so unfortunately, keep in mind that we are not going to have access to these as well! For more information you can click here

提交回复
热议问题