EFile is a modified version of original File component.The only difference between File component and the extension is that the extension does not asks for write permission if you want to write to Application Specific Directory and read permission if you want to read from Application Specific Directory or Assets.
Latest Version: 4 Released:2020-06-10T18:30:00Z Last Updated:2021-06-22T18:30:00Z
Blocks
Documentation
After File Saved
Event indicating that the contents of the file have been written.
fileName ~ text
Got Text
Event indicating that the contents from the file have been read.
text ~ text
Append To File
Appends text to the end of a file storage, creating the file if it does not exist.See the help text under SaveFile for information about where files are written.
text ~ text
fileName ~ text
Get Cache Dir Path
Returns the absolute path to the application specific cache directory on the filesystem
Returns : text
Get Private Dir Path
Returns app’s private storage directory path
Get External Storage Path
Returns external storage path
Returns : text
Get Application Specific Dir Path
Returns asd path
Read From
Reads text from a file in storage.Prefix the filename with / to read from a specific file on the SD card.for instance /myFile.txt will read the file /sdcard/myFile.txt. To read assets packaged with an application (also works for the Companion) start the filename with // (two slashes). If a filename does not start with a slash, it will be read from the applications private storage (for packaged apps) and from /sdcard/AppInventor/data for the AI Companion and /sdcard/Makeroid/data for Kodular Companion.
fileName ~ text
Save File
Saves text to a file. If the filename begins with a slash (/) the file is written to the sdcard. For example writing to /myFile.txt will write the file to /sdcard/myFile.txt. If the filename does not start with a slash, it will be written in the programs private data directory where it will not be accessible to other programs on the phone. There is a special exception for the AI/Kodular Companion where these files are written to /sdcard/AppInventor/data (and /sdcard/Makeroid/data for Kodular) to facilitate debugging. Note that this block will overwrite a file if it already exists.If you want to add content to a file use the append block.
Downloads
Aix and Java file can be downloaded from here:
Credits
I am thankful to @DevYB for the idea and tests and @Taifun for suggesting me to release the extension
Also a lot of thanks to MIT for File component’s source and Kodular for this great platform
Updates
ChangeLog Version2
Bug Fixes
Fixed bug in read and write file methods
Now you can write to and read from ASD even using absolute path without any permission.
LegacyMode will now specifiy where a filename without any / should be written to.Enabling it means files will be written in Application Specific Directory and disabling it means files will be written in Private Storage Directory.
It is no longer fully compatible with Kodular Companion.
If more people get involved here, we might be able to get Kodular to deal with the permission question if you want to use an app-specific directory to avoid READ / WRITE permissions.
My very first post in the Kodular Forum already raised this question in early 2019.
Hello! First of all, I want to thank you for this extension. I learned about it thanks to bodymindpower. In my application there was a glitch associated with file blocks. When I replaced them with file blocks from your extension, the problem disappeared.
But when I added your extansion to my application and built it, when I tried to install the APK on a ZTE smartphone (Android 7), I received the following message, “Blocked by Play protection. Play protection could not find information about the developer. Applications from unknown developers may be unsafe.” Accordingly, if I click OK, then the application does not install. And if I choose “Install anyway”, then everything is OK.
Has anyone come across a similar one? I have noticed that this message appeared exactly after I added the file blocks from your extension. Did it just happen to me? Dear users, who also use this extension, can you check your applications?
Once again, I want to emphasize that this is a very good extension. I just want to understand what this message is connected with and how to avoid it.
@RusBoriska This warning is no longer displayed after your app has been published in the Play Store or after you have de-, recompiled and signed the APK yourself. See here:
Thank you. Just before that, I tested several of my applications and never received such a notification, so yesterday I decided that it was connected with this extension. Yes, of course, when the applications are tested, I will upload them to the PlayStore.
Fixed bug in read and write file methods
Now you can write to and read from ASD even using absolute path without any permission.
Thanks to @bodymindpower and @Boban
Excellent extension! I was scratching my head for a week trying to finish a game because I didn’t want it to ask for permissions to read a simple csv file from the assets.