This should only be needed for the APK, but it should work with Companion.
And to avoid storage permissions on Android 11+ you can also use my MFile
extension, which does not request storage permissions on Android 11+.
OK , thank for your sharing, Anke
Note: → Storage → File component→ FileScope → Legacy
"Legacy: Files will be read from and written to the file system using the App Inventor rules prior to release nb187. That is, file names starting with a single /
will be read from and written to the root of the external storage directory, e.g., /sdcard/
. Legacy functionality will not work on Android 11 or later."
This is imprecisely (incorrectly) formulated. It should have been said that with Legacy (or any other FileSpope) it is not possible to write to or read from
- the root directory or
- an arbitrary folder.
So in other words, a non-media file can only be written to one of the Shared folders (/Download or /Documents) on Android 11+ (when using a slash at the beginning).
The only difference between
- FileScope = Shared and
- FileScope = Legacy
is that Legacy can also write to the Private directory (internal storage) if the file name starts without a slash (eg
file.tx
t).