0

I need to make communication between PC software (written in java) and android app over usb cable. The PC software will send some data (Strings) to Android app witch will accept those strings and do some action depending on the message received. What is the best way to do this?

I am looking all over the internet and can't find any solution to this. If someone has example of this communication i would be very grateful.

I already done this communication over sockets, put i need to cover situation if there is no router or internet connection.

Thank you

StefanP
  • 47
  • 6

1 Answers1

0

Check following article. I guess similar question to your on SO.

If you want to communicate between Android USB device and some USB host you need to use the accessory mode (https://developer.android.com/guide/topics/connectivity/usb/). But this mode requires special driver support on the USB host side (which is your PC).

fr3ddie
  • 406
  • 6
  • 17
  • Thank you for answer. I found those article too, and follow links in answer there, but i didn't understand totally how this things work. The example of this communication would be great, but i can't find it anywhere. – StefanP Nov 10 '20 at 09:52
  • Here is some example: https://stackoverflow.com/questions/13217755/usb-interface-in-android/19312893 And android docs: https://developer.android.com/guide/topics/connectivity/usb/host#java – fr3ddie Nov 10 '20 at 10:03