简体   繁体   English

通过 USB 电缆进行 PC 到 Android 通信

[英]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.

相关问题 通过/通过USB电缆将Android设备与Localhost(My Windows 8 PC)通信 - Communicate Android Device to Localhost (My Windows 8 PC) over / via USB Cable USB上的Android Java通信 - Android Java Communication over USB 通过USB进行Android和PC通信:什么是安全目录,我可以在其中使用ADB推/拉并从其访问Android应用程序? - Android and PC Communication over USB: What is a safe directory that I can use ADB push/pull on and access from an Android app? 通过PC与Android手机实现USB通信是个好主意吗? - Is it good idea to implement USB communication through PC to android phone? Android(附件模式)和Windows PC(主机)之间的USB通信 - USB communication between Android (accessory mode) and Windows PC (host) 通过USB线将PC连接到Android设备以形成Client-Server链接 - Connect PC to Android device to form a Client-Server link via USB cable 通过单条RS232电缆在android设备和非android智能电视之间进行通信 - Communication between an android device and non android smart TV over single RS232 cable Android 应用程序 Http 请求通过 USB OTG 与 Arduino 进行通信 - Android app Http requests communication over USB OTG with Arduino Android USB到Java(PC) - Android USB to Java (PC) 如何通过USB(电话到PC)进行通讯? - how to make Communication via USB (phone to PC)?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM