Taifun FileList method not showing all the files in shared storage

I'm having trouble with Taifun fileList block. It's not showing all the files in internal_storage/Documents/rittenregistratie. Also when I create a file with my app, it shows with FileList, but when I change the name of the file with Total Commander it is not shown with FileList anymore. Can it have something to do with read permissions?


see the overview here

which means in your case you are trying to read non media files (csv files) from shared storage, so as you can see from the overview the file extension is only able to list your own files, but not those from other apps, for that you have to use the SAF extension

EDIT: to set the scope property of the file component to something is not relevant for the file extension...
Taifun


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

2 Likes

The files are all mine, but only the ones I didn't manually edit name or something are shown with FileList. But perhaps you mean that when I rename a file it has a different owner and my app isn't the owner anymore.

I just experienced another strange thing. I saved a file with my app (in /Documents/rittenregistratie/) and deleted it by hand. After that I couldn't save a file with the same name with my app. After putting an extra _ in the save function the file was saved again.

yes
Taifun

Strange behaviour... It's in the shared folder so why can't the app see or open the file anymore? Is there a way to work around that?

Yes, and therefore, since targetSdk 30, I always add a timestamp to every file that is created / saved by the app. So something like that (fileName_timestamp.txt) e.g.
fileName_MM-dd-yyyy_HH-mm-ss.txt

Of course, this only makes sense if the file can be recreated without changing the functionality of the app. So if, for example, a voice file has been recorded and should not be recreated / replaced, then of course this procedure is out of the question. Then you should make sure that this file is difficult to find by the user by saving it in a hidden folder or in a subfolder of the ASD that most users will not be able to find.

1 Like

because another app renamed it, so it is not your app's file anymore

the SAF extension

Taifun

I don't understand why an extension is needed. What does the extension do to get around this ' owner' issue?
I just need read rights on the file in a shared folder, also when a user has copied the file to that folder. I need it so that the user can restore the database after a crash / new phone or something.

Take a closer look at this overview.

Ah, so that is Storage Access Framework API. Thanks, I will try it.

SAF works great!