How to find USB storage path programmatically?

老子叫甜甜 提交于 2019-12-07 08:44:43

问题


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:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!