Android蓝牙编程的代码示例 [英] Code samples for Android Bluetooth programming
问题描述
我是 Android 新手.我正在寻找一些用于 Android 蓝牙编程的代码示例.你能帮我把它们贴出来吗?任何有用的链接将不胜感激.
I'm new to Android. I'm looking for some code samples for Android Bluetooth programming. Could you please post them for me? Any useful link would be appreciated.
推荐答案
我意识到这是一个旧线程,但我想我会记下一些笔记.Android 蓝牙示例(已列出)有很多问题(其中最重要的是您需要 2 台 Android 设备才能使其正常运行).
I realize this is an old thread, but I thought I'd jot some notes. The Android Bluetooth example (already listed) has a bunch of issues (not the least of which is you need 2 Android devices to get it to function).
在 http://luugiathuy.com/2011/02/android-java 上查看示例-蓝牙/他在 Android 设备上使用蓝牙来访问服务器(做一些机器人工作).
Take a look at the example at http://luugiathuy.com/2011/02/android-java-bluetooth/ where he is using BlueTooth on the Android device to hit a server (to do some robotics work).
注意 UUID 问题(UUID 中定义了蓝牙决定它可以建立什么连接的方式),并查看http://www.avetana-gmbh.de/avetana-gmbh/produkte/doc/javax/bluetooth/UUID.html
Be aware of UUID issues (the way that BlueTooth decides what connection it can make is defined in the UUID), and check out http://www.avetana-gmbh.de/avetana-gmbh/produkte/doc/javax/bluetooth/UUID.html
请记住,UUID 中表示的 16 位(即,0x1101
表示串行端口)具有误导性,因为它实际上是最不重要的部分,需要编码 0x00001101
代码>.
Keep in mind that the 16 bits represented in the UUID (ie, 0x1101
for Serial Port) is misleading in that its really the least significant part and needs to be coded 0x00001101
.
这篇关于Android蓝牙编程的代码示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!