Android Question What permission in code or manifest to view all files

Markos

Active Member
Licensed User
Longtime User
Hey All,

Android 33+ is not allowing me to see all files (only showing folders) when I call File.ListFiles to get the list of files in a particular folder. In earlier versions using the request to access externalfolder etc with rp.PERMISSION_READ_EXTERNAL_STORAGE it worked fine.

What is the code and logic to permit to see the files listed at very list using the File.ListFiles command?

Also I want to see all files Not just media of which I'm getting no files in the list at all.

Thanks
 

Markos

Active Member
Licensed User
Longtime User
Thanks Erel,

I was able to use the following to view the files
B4X:
        Dim cc As ContentChooser
        cc.Initialize("cc")
        cc.Show("*/*", "Choose File")
        Wait For CC_Result (Success As Boolean, Dir As String, Filename As String)

But the Dir and Filename returned worked fine with File.ReadString (Dir, Filename) etc but I was using RandomAccessFile and for some reason that initilize method parameters raised an exception when passing the Dir and Filename parameters stating no such file or directory , code called is below

B4X:
Dim ra as RandomAccessFile
ra.Initialize(Dir, FileName,True)
 
Upvote 0

Markos

Active Member
Licensed User
Longtime User
Just to Highlight the Dir and Filename returned from ContentChooser

Does Not Work with RandaomAccessFile Initialization , sample code below

B4X:
Dim ra as RandomAccessFile
ra.Initialize(Dir, FileName,True)

But Works for File.Readstring etc

B4X:
Dim s as string
s = File.ReadString (Dir, Filename)
 
Upvote 0

Markos

Active Member
Licensed User
Longtime User
I was able to find a work around using File.Readbytes and rRandomAccessFile.initialize3

But if possible in the future to allow RandomAccessFile to have the same capability as File.Readstring/Readbytes in using Dir and Filename from ContentResolver
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…