简体   繁体   English

android app通过USB将数据发送到外围设备

[英]android app to send data to the peripheral through USB

I want to develop an android application to be written in html5 and Javascript which sends a string "001" to the peripheral( connected via USB). 我想开发一个用html5和Javascript编写的android应用程序,它将向外围设备(通过USB连接)发送字符串“ 001”。 I've googled about it and knew that javascript don't have access to the external hardware. 我已经在Google上进行了搜索,并且知道javascript无法访问外部硬件。 As this a part of my project i am having big trouble. 作为我项目的一部分,我遇到了很大的麻烦。

Android App.(javascript) <----USB---> peripheral(receives string 001) Android应用程序。(javascript)<---- USB --->外设(接收字符串001)

Has somebody already done this or have idea about this? 有人已经做过或对此有想法吗?

Expecting some Suggestions and help. 期待一些建议和帮助。 Thank you 谢谢

(late answer to a valid question) (对有效问题的最新答案)

In a scenario like this, a native application is required to act between the HTML5 part and the peripheral. 在这种情况下,需要本机应用程序在HTML5部分和外围设备之间进行操作。 There have been major changes to USB communication in Android since API 12. 自API 12起,Android中的USB通信发生了重大变化。

There is plenty of information online, including two samples from the Android Developers group: AdbTest and Missile Launcher . 在线上有很多信息,包括来自Android开发人员小组的两个示例: AdbTestMissile Launcher

Of course, firstly you should read the official documentation on the subject here and here . 当然,首先您应该在这里这里阅读有关该主题的官方文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM