I connected USB storage to my phone and I used
getExternalFilesDirs("");
to find all directories including sdcard and USB.
The path of sdcard comes out correctly, but USB path does not come out by the function.
Is there anyway to find relative path of USB instead of absolute path?
I've been stuck at this problem for few weeks, but got nothing.
Due to Android permissions you may not be able to do this, but here's the recommendation anyways. Try to read the contents of /proc/mounts and grep "sda1". It'll show you the mount point of your USB drive.
来源:https://stackoverflow.com/questions/30976189/how-to-find-usb-storage-path-programmatically