Hey Guys,
I'm looking for a way to build an app with internal file picker. I use Ankes AllFilesPermission and I can show "/storage/emulated/0/" in a list ListView.
But I need to show what's on the connected USB-Stick. So I used a File Manager, opened the USB-Stick and got File-Information. It shows, that it is stored in "/mnt/media_rw/BCCF-52C0/".
So, I need to show "/" in my ListView like it is possible in my file manager or for example with VLC-Player. Is this somehow possible or is there another possibility to get access to the USB-Stick.
I don't want to use any file picker solution for picking a file with an external app. This solution depends on what file manager is on the device, and so I cannot exert any influence.
Try my file extension
It offers the methods AvailableStorageDirectories and FileList
Taifun
I tried but AvailableStorageDirectories shows only /storage/emulated/0/ although I have given all files access via android.settings.MANAGE_ALL_FILES_ACCESS_PERMISSION.
there seems to be a difference between accessing an external (removable) sdcard and an usb stick...
unfortunately I do no have another idea currently...
I can try later to connect an usb stick to my device...
Taifun
You can try this.
Why should this give us different results than the FilePicker component?
@Anke
UsbDetector extension gets devices list from UsbManager. It is not related to picking storage devices or directories.
Yeah that's what I said in my last post.
The issue faced by op is that AvailableStorageDirectories block in TaifunFile extension does not give usb drives path for some reason.
None of your proposed solutions above show that list before opening picker ui.
As you can see, it's no problem to display all directories (including USB devices) in advance without SAF.
Ok, then you have full access to the USB-Stick also on Android 11+ and especially on Android 13+ (even to non-media files).
Thanks a lot for your thoughts, and sorry for may late replay.
I tried around with SAF this afternoon. I can choose the USB-Drive with SAF-FilePicker now, and I can show the USB Drives directory, but I couldn't find a solution to show the directory in a ListView (for picking a file).
This works perfectly on an Android 5 device. I don't currently have a USB-A to USB-C adapter, so I can't test it on Android 11+. However, I'm pretty sure it will work. I'll test it tomorrow or in the next few days...

Where does this block come from?












