Android: USB Communication Android <-> External Device

13,479

Solution 1

I'm basically doing the same you are describing. I'm still at the early stages but I've managed such communication under some constraints:

  1. You need a device supporting the USB Host API. The API itself has been around since Android 3.2 or so, but not every device seems to support it. It looks like most of the devices running >4.0 should work, but still is a per device check you should do. I'm currently using an Acer Iconia Tab A510, which so far seems to work but has some glitches: for instance, you cannot charge the device while using the USB port as it is shared with the charger but not compatible with USB.
  2. As Neil says the USB API is low level, so I think you will need a driver for your USB chipset (the one at your side, i.e. in your device). I've been quite lucky here as there's an open source project working on FTDI chipsets that happen to be the ones I've chosen. If that's your case too, you should check the projects:

I hope this helps. As I've said, I'm starting to work in this ecosystem and I still have to find my way around many "places".

Cheers, Asier.

Solution 2

Currently the adb interface is one way. Flow is controlled by the host PC using adb. Looking at your requirement, looks like you might need to open up the source code, re-tune the USB driver to allow communication both ways. After that, you will need to design your very own API that allows an application to send messages via USB. This will require a lot of work as the current Android model does not support it.

Share:
13,479
Admin
Author by

Admin

Updated on June 10, 2022

Comments

  • Admin
    Admin almost 2 years

    I found several threads speacking about this subject, but after read them I don't have a clear idea about my problem.

    We have a external device (something like a tomtom device, I mean, not an accessory) and we want to connect this device to an android device. And we want to have serial communication between the external device and the android device using a USB connection. (At this time we have communication between the external device and other non android devices using RS232 interface, but the external device can handle the communication using a usb cable)

    As I read, we have USB API support since 3.1.

    Can we develop an android application which communicates with our external device using USB cable? I mean, sending data to the device and receiving data from the device, both ways, we want to use the Android device as a "display".

    Thank you very much in advance.