我创建了一个具有 WRITE_TYPE_NO_RESPONSE 特性的外设。 对于另一个应用程序,我写了特性,但我偶尔会遇到带有 lollipop 5.1.1 的 samsung galaxy nexus i9250 问题: 有时函数 BluetoothGatt.writeCharacteristic 返回 false 并且写入未完成。
它会是什么?这可能是cyanogenmod的错吗?我可以用什么方式解决这个问题?
在外围设备上:
new BluetoothGattCharacteristic(
UUID.fromString(characteristic),
BluetoothGattCharacteristic.PROPERTY_WRITE_NO_RESPONSE ,
BluetoothGattCharacteristic.PERMISSION_WRITE);
编辑:这个问题只发生在 android >= 5.0.2
在 kitkat 和 android 5.0.1 上从未发生过,是偶然的吗?
最佳答案
我通过在连续的 BluetoothGatt 读/写调用之间留出一秒的间隔来解决这个问题。
关于android - bluetoothGatt writeCharacteristic 返回 false,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30737658/