8

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.

Shail Adi
  • 1,502
  • 4
  • 14
  • 35
  • 1
    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 : http://gphoto.org/proj/libgphoto2/ which is specific to digital cameras. – Acacio Martins Oct 29 '12 at 09:50
  • No I'm not but the probability is high. You might ask the developer. – Acacio Martins Oct 29 '12 at 12:39
  • Possible duplicate of [Android detect usb storage for kitkat (4.4)](http://stackoverflow.com/questions/36208297/android-detect-usb-storage-for-kitkat-4-4). There I posted solutions for pre-6.0 and 6.0/above. – Peter Tran Jun 16 '16 at 23:14

4 Answers4

4

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

SAURABH_12
  • 2,262
  • 1
  • 19
  • 19
3

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.

Techwolf
  • 1,228
  • 13
  • 32
  • But the android device does not detect the USB devices. Have you ever tried the concept you are recommending!! – Shail Adi Nov 08 '12 at 17:04
  • That's what it does on my phone. What device are you using? – Techwolf Nov 08 '12 at 17:20
  • LG Optimus...can you hint me with the code implementation to detect the usb. – Shail Adi Nov 12 '12 at 10:48
  • What version of Android does it run? This will only work on newer phones. If it doesn't work, you might have to implement it yourself, with the USB Host API. More information on that can be found here: http://developer.android.com/guide/topics/connectivity/usb/index.html – Techwolf Nov 12 '12 at 23:30
  • But USB Host API was included from android 3.1. And then also it depends on the hardware of the device to act as a USB Host, present in the newest phones only. I thought you were suggesting something for the prior ones... – Shail Adi Nov 13 '12 at 02:26
  • 1
    Whether it's implemented in phones prior to Android 4.0 I think depends on the manufacturer. Some have it, some don't. – Techwolf Nov 14 '12 at 07:37
2

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.

Dwight Holman
  • 1,570
  • 14
  • 15
2

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.

Arveen
  • 868
  • 6
  • 18