Android apps, communicating with a device plugged in the USB port

Solution 1:

The world has changed since this question was asked, and the answer is now the Android Open Accessory Development Kit. It won't solve the problem for existing USB devices, but it makes it possible to create new devices that can use an Android device's USB connection.

Solution 2:

Communication between Android Device and PC is possible in one more way.

Through ADB connection via USB.

  1. Port Forwarding.
  2. Server Socket JAVA Program.
  3. Client Socket Android App.

Through this app can communicate with the our JAVA Program running on PC.

http://www.anothem.net/archives/2010/10/15/android-usb-connection-to-pc/

Solution 3:

Edit: Please note this answer predates the availability of the Android USB host and accessory APIs and support found in many devices released after it was written.

If you turn on usb debugging on the phone and have something derived from the sdk's (open source) adb tool on the pc, they can communicate. The pc will have to initiate communications but within the sessions it can be mostly bidirectional or even mostly from device to pc. See developer.android.com about the adb shell and port forwarding. Root not required.

People are using bluetooth to talk to arduino embedded controllers.

With root I have made my phone act as a usb host, but it was a pain as I had to use wifi to get a debug shell since the usb was occupied.

Some phones have a low voltage serial port on an extusb connector or audio lines, but root and a level shifter would be required to use this.

Another idea I had been thinking of, doing a software modem on the headset jack, apparently has been done for both android and iphone by someone in Japan. This should not require root.