How to save a file (Android 10)

Hi guys,
I'm using android 10, i have seen that the File component save the file in an internal directory not easy to reach. So I've find this solution.
file

index.html or file.html is the same. My mistake

I use delete to change completely the file (file/index my mistake)

Is this a problem or a solution ?

What you are doing is currently as expected when using legacy mode. This will break when AI2 starts targeting API 30 (nb187 release)

There is still some discussion about being able to save files to a shared directory, but files will be saveable to the application specific directory.

hi, It's a solution, fileSave does'nt go well (the file is saved in an internal directory not easy to reach), with this metod It goes well like time ago (I use android 10)

and from the documentation:

LegacyMode

Allows app to access files from the root of the external storage directory (legacy mode). Starting with Android 11, this will no longer be allowed and the behavior is strongly discouraged on Android 10. Starting with Android 10, App Inventor by default will attempt to store files relative to the app-specific private directory on external storage in accordance with this security change.

Note: Apps that enable this property will likely stop working after upgrading to Android 11, which strongly enforces that apps only write to app-private directories.

1 Like