Write to a textfile

I´m trying to write to a text file using the file component. This must only work with MIT AI2 Companion, so there should not be any problems with permissions. I use a Google Pixel with Android 13 grapheneos.
I can write to a file and then read it back within the app, but I cannot find the file I made anywhere on my phone. Where could it be???

The file is in your apps ASD folder, usually only visible from your app. You can use the Total Commander file manager app to access your ASD if you wish.

Or you can share the text file with Share component with in app.

Or you can save it in one of the Shared folders /Documents or /Download

grafik

To avoid storage permissions on Android 11+ you can use my MFile extension.

1 Like

Thanks for your good ideas. Unfortunately, none of them works for me.

  1. I tried to save to /Documents/Test.txt, but there is no file in the Documents folder when I look for it?
  2. I tried the share component but this tries to get the file from ///Test.txt instead of /Test.txt and gives an error message (could not find file). Also, I get an error message when I try to save to ///Test.txt with the file component. So this cannot work.
  3. I don't want to root my phone to get to the ASP folder.

Any other ideas?

Try this aia project example. tested with companion on Google Pixel 4a, Android 13.
Note: Filescope is set to Legacy in BOTH Screen1 properties and the File component (then I go into overkill by setting the File component filescope to legacy for each step!)

SaveFileToDocuments.aia (3.7 KB)

Blocks

This is working. Thanks a lot. I`m not sure yet what I did wrong but I will find out...

Show your blocks.

And tell us if you have set DefaultFileScope to Legacy. This is unfortunately necessary (on Android 11+) if you test it with the compiled app. We've all been waiting for months / years for this bug to finally be fixed by the MIT team.

Okay, I'm very embarrassed, but I just forgot to set DefaultFileScope to Legacy. Thank you all for your help.

how you store and Share?