I need to access the files in the Download folder on my device. I am first requesting PERMISSION_WRITE_EXTERNAL_STORAGE and then listing the files in Download folder. For some reason not all are being listed. The code I use is like this
There are some pdf, binary and jpg files in the Download folder but I can get listed only the jpg files. If I use file manager app and change the name of the files that I can get listed and run the code again I can see the filenames being changed so I know I am working in the right folder. I already examined the file system read/write permissions (rwx), UID and GID but found no differencies between listed and unlisted files.
What could be the reason for this and how to fix it?
I have made a working solution with ExternalStorage but I would not like to use because it ruins the user experience. Specifically SelectDir dialog is annoying because if you would like to select the folder it opens in in you need first to go level up and the come back before you are able to make selection. Also it is confusing that you can see the files you would like access in the dialog but can't open them yet.
B4X:
Dim rp As RuntimePermissions
rp.CheckAndRequest(rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
Wait For B4XPage_PermissionResult (Permission As String, Result As Boolean)
If Result = True Then
Dim files As List = File.ListFiles(File.Combine(File.DirRootExternal, "Download"))
For Each f In files
Log(f)
Next
End If
There are some pdf, binary and jpg files in the Download folder but I can get listed only the jpg files. If I use file manager app and change the name of the files that I can get listed and run the code again I can see the filenames being changed so I know I am working in the right folder. I already examined the file system read/write permissions (rwx), UID and GID but found no differencies between listed and unlisted files.
What could be the reason for this and how to fix it?
I have made a working solution with ExternalStorage but I would not like to use because it ruins the user experience. Specifically SelectDir dialog is annoying because if you would like to select the folder it opens in in you need first to go level up and the come back before you are able to make selection. Also it is confusing that you can see the files you would like access in the dialog but can't open them yet.