我有一项通过mac地址直接连接蓝牙葡萄糖设备的服务。
if (mBluetoothGatt != null) {
if (mBluetoothGatt.connect()) {
return true;
}
else {
return false;
}
}
mBluetoothGatt = device.connectGatt(this, false, mGattCallback);
配对例程和从设备下载数据在配对后第一次完美,但如果我尝试重新连接到设备并注册通知,我会在BluetoothGatt.onDescriptorWrite方法中收到GATT_INSUFFICIENT_AUTHENTICATION错误。
@Override
public void onDescriptorWrite (BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status) {
...
if (status == BluetoothGatt.GATT_INSUFFICIENT_AUTHENTICATION) {
...
系统然后提示用户输入密码并要求他们重新对设备进行身份验证,即使BONDING STATE显示为BONDED。
我已经阅读了很多关于BLE的StackOverflow帖子,其中一些是冲突的,或者没有直接解决连接处理的问题。
我正在使用的设备是带KitKat 4.4的Moto G.
答案 0 :(得分:0)
升级到Lollipop解决了这个问题。验证现在可以完美运行,每次创建新连接时都不会收到提示。