I am trying using RxAndroidBLE API to scan, connect and do write operations on BLE device. I am using following code to do writeCharacterstic operation
bluetoothGattCharacteristics.setWriteType(BluetoothGattCharacteristic.WRITE_TYPE_DEFAULT);
final Disposable disposable = connectionObservable
.firstOrError()
.flatMap(rxBleConnection -> rxBleConnection.writeCharacteristic(bluetoothGattCharacteristics, data))
.subscribe(
characteristicValue -> {
onWriteSuccess();
},
throwable -> {
onWriteFailure(throwable);
}
);
This code works fine in android 9 or above (Not tested on android 8). But on android 7, writeCharacterstic fails with error com.polidea.rxandroidble2.exceptions.BleGattCallbackTimeoutException: GATT exception from MAC address F6:91:6D:C6:37:1F, with type BleGattOperation{description='CHARACTERISTIC_WRITE'}
I using latest release of RxAndroidBLE i.e. 1.11.1. Please suggest ..
Update
on more looking into this, found that if device state is already bonded on connect (bluetooth device saved in phone paired device list), write operation failing.