codenameone / CodenameOne

Cross-platform framework for building truly native mobile apps with Java or Kotlin. Write Once Run Anywhere support for iOS, Android, Desktop & Web.

Home Page:https://www.codenameone.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to write to Android 13 Shared Storage

mwarnett opened this issue · comments

My app needs to write to an accessible shared storage folder where the user can access the file I create.

This was no problem back in the early days of Android but I did have trouble in Android 11 which I was able to address. It continued to work in Android 12, but it fails in Android 13. Google changed the file system again.

My understanding of how to do this in Android 13 is from this page: https://medium.com/@vivekvashistha/how-to-save-a-file-in-shared-storage-location-in-android-13-c1e4fdf3d2cb

You start by creating an intent, an ACTION_OPEN_DOCUMENT_TREE Intent which will display a picker and the user can select the folder where the file will be created. The app can then get read/write access to this folder and finally create the file.

The question is how can I do this in CondenameOne?

For context the discussion is ongoing here. This is something @shannah is working on quite hard as it will require a significant overhaul to FileSystemStorage with the goal of making this almost seamless.

Thanks for the update.