How to find USB storage path programmatically?

2.7k views Asked by At

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.

1

There are 1 answers

0
Santiago Villafuerte On

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.