EFile : Only asks for permissions when required

Introduction

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

image

image

Documentation

  • After File Saved
    Event indicating that the contents of the file have been written.
    component_event
    fileName ~ text
  • Got Text
    Event indicating that the contents from the file have been read.
    component_event (1)
    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.
    component_method
    text ~ text
    fileName ~ text
  • Get Cache Dir Path
    Returns the absolute path to the application specific cache directory on the filesystem
    image
    Returns : text
  • Get Private Dir Path
    Returns app’s private storage directory path
    image
    Returns : text

See here why is it important: Problem with July 30 2020 Version: nb184 no longer able to write and read files - Bugs and Other Issues - MIT App Inventor Community

  • Get External Storage Path
    Returns external storage path
    image
    Returns : text
  • Get Application Specific Dir Path
    Returns asd path
    image
  • 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.
    component_method (1)
    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.
    component_method (2)

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 :heart:
Also a lot of thanks to MIT for File component’s source and Kodular for this great platform :heart_eyes:

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.
ChangeLog Version3

New Blocks
image
Thanks to @bodymindpower

Changes

  • Some internal changes
ChangeLog Version4

New Blocks
image

Changes

  • 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.

Hope it helps! :grin:

38 Likes

That’s great.

This should be no difference anymore, after @Kodular resoved this bug.
I’m sure they will do it.

4 Likes

Means, this will work without asking write permission?

1 Like

Yeah, not for me personally, but I bet thet it is helpful to soo much other people.

So many different and useful blocks!

Again another great extension from @vknow360! :heart: :heart: :heart:

Yoshi

3 Likes

Yes, give it a try …

1 Like

Another great extension by vknow360

1 Like

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.

3 Likes

Again a great work by @vknow360 :partying_face::partying_face: :v:

3 Likes

Again a great work by @vknow360
keep it up

3 Likes

Great extensions @vknow360

1 Like

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.

Thanks so much :heart: for giving this amazing extension

1 Like

what about doing a search in the community?


Taifun

1 Like

@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:

1 Like

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.

ChangeLog Version 2

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.
    Thanks to @bodymindpower and @Boban
3 Likes

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.

Thank you very much for making this extension.

3 Likes

Your appreciation means a lot to me :heart:


ChangeLog Version 3

New Blocks
image
Thanks to @bodymindpower

Changes

  • Some internal changes
7 Likes

Good work !!! I test this extension soon …

2 Likes

Good work it’s best extension