Files file path (yet again)

I only use Inventor every few years, and Androids seem to change every time I try to use them.

I'm trying to read a text file with the FILE gadget, and for the life of me, I haven't been able to specify a path that works.

If I connect my phone to my desktop, Windows Explorer shows my file in
"This PC\Galaxy S21 5G\Internal storage\AppInventor"

I've tried a dozen different paths and the all cause "can't find file" errors.
For example, I've tried
/AppInventor/test.txt
/storage/emulated/0/AppInventor/test.txt
/Internal Storage/AppInventor/test.txt

A ten minute quickie has already consumed a couple of hours!

Which Android version?

You cannot access non-media files outside of the ASD or Shared folders (/Documents or /Download). And those files must have been created by the app itself. Otherwise you need SAF.

You cannot access the root dir of the external storage (/storage/emulated/0/) or any arbitrary subfolder of it like this (at least not on Android 11+):

"/Documents/test.txt" did not work as the path. I guess I need a bigger hint. You wouldn't know I'm actually an MIT grad ;-(

Android/data/appinventor.ai_jjgurley.survey/test.txt
/data/data/appinventor.ai_jjgurley.survey/test.txt

don't work either

Something different.

I used the simple path "test.txt" and it apparently found the file in the private storage, but rather than reading the file, i got "com.google.appinvent....Fila@952a5c8" when I thought I should get the text within the file.

Figured it out. Thanks for your help.

Fine, but let the audience know what your solution is. Others also want to learn from it.
(I removed the Solution marker.)

Btw, I made many posts / topics on this (search the forum!), see e.g. here:

The success I had was using data stored in the apps private area, and the problem with the "com.google.appinvent....Fila@952a5c8" was due to loading the filename instead of the file contents.

Although that reads a file from my apps' private storage, finding that location is too hard given the complex filepaths. I really want to use /Documents, which I can't figure out.

"/Documents/test.txt" does not work.

Did you try my test APK from my second link?

"/storage/emulated/0/Documents/test.txt" doesn't work.

With my test APK?
If so, change the FileName to myFile_2.txt (in the first Textbox) and try again.

@Anke, did you use current components or your myfile extension ?

I pasted your path into my app. test.txt exist and is in /Documents.

You cannot access (save / read) a non-media file (like myFile.txt), that was not created by the app itself (at least not on Android 11+).

In this case you need SAF (Storage Access Framework).

Then I guess I'll live with the horrible path to get to the private storage. Nice of Google to save us from ourselves...

Yes, apart from Google itself, no one is amused by this. :wink:

:question: