Use (Read, write) non media file

Hello,
I am making a new application that must manage several files (Creation, reading, writing). These are text files in a special folder and I want to give them the extension ".combi"
With the app, I created a folder "COMBINAISONS" in /Documents (OK).
I can also create one of my files "Combinaison1.combi" (OK)
But when I simply want to see the list of files in Combinaison, it returns an empty list. It works if they are JPGs but not with a non-media file.
I have already looked at this post

But it does not solve anything
Thanks for your help

Is the file "Combinaison1.combi" also created by the app ? (what type of file is it ?)

How are you trying to see a list of files ?

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

Yes, the file and directory are created by the app

Hello,

Here is a screenshot of the app.

The folder is created with the app, the .combi files are created with the app.
1 - When initializing I open the read and write permissions and I define my path.
2 - I want to list my .COMBI files to process them but I don't have my files, only the "media" files
Here is a screenshot of my /Documents/Combinations folder on my phone

3 - the block that works to create my .COMBI file

The goal is to create a .COMBI file that I could distribute by email to other people. They will have to download it and put it in their Combinaison folder to be able to open it with the app installed on their device.

Given that, you will probably want to be using SAF in your app.

You can select individual files or list a directory.

What happens, if you use the file extension .txt instead of .combi? Also try file scope Legacy...

To read non media files, which not have been created by your own app you need SAF, see also Some basics on Android storage system

Taifun

Thanks for your feedback.
I tried with .txt and I don't see it. I tried different extensions and only "media" files are visible
I also tried in "legacy" and I have the same results.
I started looking at SAF, I'll test it, but it seems complex.

On the device you stored it you should see the text file...

as test, delete the file again, store it as .txt and then list it without switching between companion app and apk file a) using file scope Shared and b) using file scope Legacy...

Taifun

What phone/device do you have, make/model/android version ?

HI,
My phone is a SAMSUNG A71 with Android 13.

I'm testing SAF, but it crashes from the beginning!!!

I copied blocks from a forum help post but it doesn't work. Yet it seems very simple.

I have trouble understanding URI, URISTRING,... and SAF in general.

Take your time and read the complete SAF thread... there are also a lot of examples available...

Taifun

In companion this works:

image

Note: use SAF1.GetTreeDocumentId (not SAF1.GetDocumentId)

Oh yesss ! I didn't see the mistake, I must have taken the block too quickly

This is my "bible"!
But it's complicated.