[英]PC to Android communication over USB cable
I need to make communication between PC software (written in java) and android app over usb cable.我需要通过 USB 电缆在 PC 软件(用 Java 编写)和 android 应用程序之间进行通信。 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. PC 软件将向 Android 应用程序发送一些数据(字符串),该应用程序将接受这些字符串并根据收到的消息执行一些操作。 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谢谢
Check following article .检查以下文章。 I guess similar question to your on SO.我想与您在 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/ ).如果你想在 Android USB 设备和一些 USB 主机之间进行通信,你需要使用附件模式( https://developer.android.com/guide/topics/connectivity/usb/ )。 But this mode requires special driver support on the USB host side (which is your PC).但此模式需要 USB 主机端(即您的 PC)的特殊驱动程序支持。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.