bluetoothGatt writeCharacteristic returns false

南楼画角 提交于 2019-12-22 09:01:33

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!