MFile - a modified version of Sunny's `EFile` extension - Shared folders - storage permissions - Android 11+

[edited]

If a text/csv file is owned/created by your app, then use the File component to write, but use SAF to read.

If a text/csv file is NOT owned/created by your app, then you need the SAF extension to read/write.

Or just use SAF for read/write operations.

1 Like

1 Like

Currently MFile is not offering option to read file directly without saving it. Correct me if I am wrong.

If so can you develop one more block that is made using SAF technology to read files directly and even in higher Android versions?

Use the SAF extension!

You are wrong, MFile can of course read a text file directly without saving it, but the non-media file (.txt, csv) must be created by the app itself.

1 Like

Yes, it worked.

Can MFile recognize the rowdata or cell data or column data of csv file precisely? If so, I can parse specific data? Is there any way to do it?

There does not exist any possibility to edit parts of a file without first reading it completely, editing it and saving it again

You already received my answer here 1) Read .csv file from phone, 2) Seach for a keyword 'Apple4321' 3) If keyword found, then look for the nearest word if it is 'send' 4) If the word 'send' is found do some action like 'play music' - #9 by Taifun

It is a bad design choice to use a file as data storage if you have to edit data frequently, because it is cumbersome to work with files

You have to read it completely, edit what you want to edit and save it again...

And

Remember, you have to use SAF to read/write non media files your app does not own, see also Some basics on Android storage system

Also you might want to think about how you plan to solve the problem of 2 processes (Tasker and your app) writing at the same time
.

See again my suggestion without Tasker and without using csv files 1) Read .csv file from phone, 2) Seach for a keyword 'Apple4321' 3) If keyword found, then look for the nearest word if it is 'send' 4) If the word 'send' is found do some action like 'play music' - #28 by Taifun

Taifun

1 Like

I can remember that once you told that if we use a file file:///storage/emulated/0/Download/1.txt in companion then we must delete it before using it in app after installation.

Can we automate this process using blocks? May be as below?

if the file is not created by this app, how can it delete the file?

1 Like

I created the file already using the second block 'Save File'. Yes, I created using companion, is it what ypu meant?

If you test with Companion first, simply place the corresponding block in the block area and execute it via Companion with "Do it". If you want to create the APK afterwards, you can disable this block or delete it again.

1 Like

Hi, In this app, MFile is successfully creating a text file with a given text. But, after that I am not able to either update the file or delete the file using blocks.

Actually, I tried to overwrite with new text data as well instead of empty space, I tried to delete the text file by adding the corresponding block along with these blocks, but not working.

I tried all this using .apk and not companion.

You already received your answer here

Taifun

According to my English knowledge, I understood that you are saying that it is not necessary to use SAF if I don't want to publish the app in playstore. Yes, this app will be used only in my phone and it will not be published. But, still I am facing this error. Most probably, I will solve it somehow. But, If you have any Idea, please guide me. Because, you told that it is not necessary to use SAF for my case.

So where exactly are you asking for manage all file access permission?

Taifun

1 Like

If you try this with the same app, it shouldn't be a problem.

1 Like

I am confused actually. Out of confusion if I speak, I think, at beginning it worked, then when I added more blocks it didn't work. Then after adding blocks for permissions, it worked again.

Post the aia. Which Android version(s) you are testing on?

1 Like

Earliest .aia:
csvDataBase2_1.aia (1.6 MB)

Latest .aia:
csvDataBase3.aia (1.6 MB)

Android Version: 11