Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Usb data cable communication in Android [closed]

Tags:

android

usb

I want to communicate with my android application from my computer with the usb data cable. What listener should I implement?

I think a TCP connection will suit my needs but connecting with it over the adb driver seems akward.

How can I communicate from windows to android using a data cable?

like image 903
opc0de Avatar asked May 17 '12 08:05

opc0de


People also ask

What is Android accessory mode?

USB accessory mode allows users to connect USB host hardware specifically designed for Android-powered devices. The accessories must adhere to the Android accessory protocol outlined in the Android Accessory Development Kit documentation.

What is USB host mode?

In USB host mode, the Android-powered device acts as the host. Examples of devices include digital cameras, keyboards, mice, and game controllers. USB devices that are designed for a wide range of applications and environments can still interact with Android applications that can correctly communicate with the device.


1 Answers

I found a nice post about this subject here. You basically need adb in order to do the port forwarding between the Android device and the PC. As an example:

C:\android-sdk-windows\tools\adb.exe forward tcp:38300 tcp:38300

Then you can use standard socket programming, both in the Android device and in the PC.

like image 172
kgiannakakis Avatar answered Oct 04 '22 15:10

kgiannakakis