I am new to android and I am doing some project planning.
I need to access / store some files to External storage device ( pendrive ). How to find external storage device path ( pendrive ).
I am new to android and I am doing some project planning.
I need to access / store some files to External storage device ( pendrive ). How to find external storage device path ( pendrive ).
Someone else asked this recently here.
Basically, the SDK has support for only one "external storage", and that is an SD card, not a "pen drive".
USB device is recognized as Mass Storage
device if:
usbInterface.getInterfaceClass() == UsbConstants.USB_CLASS_MASS_STORAGE
|| usbInterface.getInterfaceSubclass() == INTERFACE_SUBCLASS // int 6
|| usbInterface.getInterfaceProtocol() == INTERFACE_PROTOCOL // int 80
and
usbInterface.getEndpointCount() == 2
where one of endpoint must satisfy following:
endPoint direction == 0
endPoint type = UsbConstants.USB_ENDPOINT_XFER_BULK //int 2
Refer these links for further details:
You will need an OTG cable and a rooted phone. Install Stick mount from play store. You can access pendrive
This does give you the external Storage:
File root = Environment.getExternalStorageDirectory();
Get a top-level public external storage directory for placing files of a particular type. This is where the user will typically place and manage their own files, so you should be careful about what you put here to ensure you don't erase their files or get in the way of their own organization.