8
votes

I have been checking since some time to mount external drives to android phone i.e., if I plug external drive(hard/flash/camera) to android device, the android phone should be able to access the storage file system.

There are apps in the market which controls external devices through phone.

I can use the USB Host mode { http://developer.android.com/guide/topics/connectivity/usb/index.html } to communicate with the usb device. But USB Host and Accessory modes are directly supported in Android 3.1 (API level 12) or newer platforms.

While an app named DSLR Controller { https://play.google.com/store/apps/details?id=eu.chainfire.dslrcontroller&hl=en } , requires Android 2.1 or above. Since the application is based on accessing the camera through android phone. If the app displays the correct info, then the task of accessing the storage of camera (or any other drive) seems to be possible.

But I want to use the application in lower version as well. Any kind of help will be appreciated.

Please comment,if need any more description of the problem.

Thanks.

4
Hello, I don't completely understand your question... You want to know how to access a storage device without using USB Host mode on a 2.1 Device, is that correct ? About the application you mention, I think they use this : gphoto.org/proj/libgphoto2 which is specific to digital cameras.Acacio Martins
No I'm not but the probability is high. You might ask the developer.Acacio Martins
Possible duplicate of Android detect usb storage for kitkat (4.4). There I posted solutions for pre-6.0 and 6.0/above.Peter Tran

4 Answers

4
votes

You can create an application based on FileManager open source project on Github. You can specify there to identify your device. You can change these code according to your need. Here is the link Adroid-File-Manager

3
votes

If you just want to be able to access USB storage (like a flash drive) you can open the files the normal Java way (java.io.File, etc). Android ICS automatically mounts flash drives under /sdcard/usbStorage/, but I'm not sure about previous versions or other types of hardware. It might still work, though, so I'd suggest that you test it and see what happens.

2
votes

From the app description, Android 2.x devices need to be rooted. This suggests that they have some native implementation of the USB host code (possibly a pre-compiled kernel module they load).

Therefore, the solution for this varies based on the specific hardware and software (kernel, vendor modifications, skin) it is running.

2
votes

The only sure way of getting this done is to use API level above 12, otherwise a few phones may have support for usb host but most of them wont support it. The reason being first of all you need hardware support for usb host, even if that is present the drivers needed might not be compiled into the kernel, i did some work while trying to implement usb host on nook color, even though it had hardware support, getting usb host working took almost 2 months and a dedicated app. So its not something you will be able to do for every device. A few might support it out of the box but even those would need root and lots more work for mounting drives and all that.. the DSLR camera also does it the same way look at the requirements

- Android device with ARMv7-A or newer CPU architecture (most 1ghz+ devices)
- Not rooted: Android 3.1 or higher with USB host kernel+API support
- Rooted: Android 2.3.1 or higher with USB host kernel support

These are the only devices that can support USB host.