bluetoothGatt writeCharacteristic 返回 false

aer*_*xr1 5 android bluetooth-lowenergy android-ble

我创建了一个具有 WRITE_TYPE_NO_RESPONSE 特性的外围设备。使用另一个应用程序,我写了特性,但我偶尔会遇到带有棒棒糖 5.1.1 的 samsung Galaxy nexus i9250 问题:有时函数 BluetoothGatt.writeCharacteristic 返回 false 并且写入未完成。

会是什么呢 ?会不会是 cyanogenmod 的错?我可以用什么方式修补这个问题?

在外围:

new BluetoothGattCharacteristic(
                UUID.fromString(characteristic),
                BluetoothGattCharacteristic.PROPERTY_WRITE_NO_RESPONSE ,
                BluetoothGattCharacteristic.PERMISSION_WRITE);
Run Code Online (Sandbox Code Playgroud)

编辑:这个问题只发生在 android >= 5.0.2

在kitkat和android 5.0.1上从来没有发生过,是偶然的吗?

Bil*_*med 0

我通过在连续的 BluetoothGatt 读/写调用之间留出一秒的间隙来解决这个问题。