问题
I created a peripheral with a WRITE_TYPE_NO_RESPONSE characteristic. With another application, I wrote on characteristic, but I have an occasional problem with samsung galaxy nexus i9250 with lollipop 5.1.1: sometimes the function BluetoothGatt.writeCharacteristic returns false and the write is not done.
What could it be ? Can it be cyanogenmod's fault ? And in what way can I patch this problem ?
On peripherall :
new BluetoothGattCharacteristic(
UUID.fromString(characteristic),
BluetoothGattCharacteristic.PROPERTY_WRITE_NO_RESPONSE ,
BluetoothGattCharacteristic.PERMISSION_WRITE);
EDIT : this problems happened only with android >= 5.0.2
Never happened on kitkat and on android 5.0.1 , is a casuality ?
回答1:
I resolved this issue by giving one second gap between to successive BluetoothGatt read/write calls.
来源:https://stackoverflow.com/questions/30737658/bluetoothgatt-writecharacteristic-returns-false