Here is a modified version of Sunny's EFile
extension, which added some methods that are needed (among others things) for testing purposes with Companion & AKP. Because if you try to save in one of the Shared folders (/Documents
or /Download
) first with Companion it is not possible to do this without deleting the saved text file before testing with the APK and vice versa (at least on Android 11+). So the Delete
& FileExists
& API level methods are needed.
The Delete method exists with the
File
component, but incorrectly requests storage permissions on Android 11+. This bug does not exist with this extension. In order not to be dependent on theFile
component at all, the required storage permissions for Android < 11 (API < 30) can be declared with this extension DeclareReadWrite.aix in the Manifest.
MFile.aix (16.2 KB)
Version 2 (April 8, 2022):
de.bodymindpower.MFile.aix (21.6 KB)
Note: The first version seems to have conflicts with other specific extensions. In this case, use version 2 (compiled with Rush
).
Try this app. It saves a text file in the Shared folder /Documents. It should work without storage permissions on Android 11+ using the
MFile
extension.
If you try do use theFile
component (Checkbox
disabled), you will get a permission error ("Error 908: The permissionWRITE_EXTERNAL_STORAGE
has been denied. Please enable ..."). In order to work with the File component you MUST setDefaultFileScope
toLegacy
in the Designer.This is the only way to declare
WRITE
permission in the Manifest (even on Android 11+, which of course doesn't make any sense at all, but it is required to work with the File component).
Conclusion
As long as the bugs with theFile
component are not fixed, I recommend using this extension (MFile
), at least on Android 11+.But if you want to stick with the
File
component, you MUST ALWAYS setDefaultFileScope
toLegacy
. Otherwise it will not work on Android 11+ or you MUST save in theASD
orPrivateDir
(internal storage).