View Code? Open in Web Editor
NEW
Android蓝牙开发。封装了支持Android蓝牙(经典蓝牙或低功耗蓝牙)扫描,连接,以及通信的库。附带使用例子。It encapsulates a library that supports Android Bluetooth (classic Bluetooth or low-power Bluetooth) scanning, connection and communication. Attached use examples.
hbluetooth's People
Contributors
Watchers
hbluetooth's Issues
手机蓝牙可以搜索到,通过程序不行,Android 11
你好,为什么我添加了依赖却找不到HBluetooth这个类呢?
你好,我没看明白,你这里与设备进行通信,我要发给设备的命令应该放在哪里,sender.send后面是什么?
你好,最近在尝试使用这个蓝牙库,有几个问题想请教一下,期待大佬回复。
第一个,低功耗蓝牙的 UUID 怎么传,需要进行蓝牙通信。
第二个,通信时,传输 JSON 数据,应该怎么写。Demo 中的看不太明白。
sender.send(new byte[]{0x01, 0x02}, new SendCallBack() {
@OverRide
public void onSending() {
Log.i(TAG, "命令发送中...");
}
Demo 中 通信时,在 log 中也没看到 onSending() 和 onReceived() 的回调
代码拉下来然后再三星手机上运行,扫描完成之后点击设备没有任何反应
调用这个函数connect(bluetoothDevice, classicBluetoothPairCallBack, connectCallBack)
我有一个android设备是没有界面的,然后设置为服务端,然后另外一个设备是手机设置为客户端,每次客户端去连接无界面的android智能设备都提示确认配对密码,这种怎么处理呢。我也写了监听,自动配对和设置pin值,打断点也进入了这个方法体,但是没有效果。谢谢大佬
//自动配对设置Pin值 @Throws(java.lang.Exception::class) fun autoBond( btClass: Class<*>, device: BluetoothDevice?, strPin: String ): Boolean { val autoBondMethod: Method = btClass.getMethod("setPin", ByteArray::class.java) return autoBondMethod(device, strPin.toByteArray()) as Boolean }