-
Notifications
You must be signed in to change notification settings - Fork 588
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RxBle is not show disconnected when BluetoothGatt: android.os.DeadObjectException is thrown #275
Comments
Could you check against |
Dear @dariuszseweryn, I have checked this issue in 1.4.0-SNAPSHOT, this bug is occur too. However, Bluetooth is crashed on Samsung Note II (rooted). I can not make bluetooth on Samsung J7(or HTC U11 because they are not rooted) is crashed. Thanks |
`DeadObjectException` is usually thrown when interacting with `BluetoothAdapter` or `BluetoothGatt` instance that was obtained before bluetooth being turned off. Prior to library version `1.3.0` all errors raised when interacting with `BluetoothGatt` or recieved by `BluetoothGattCallback` were closing the connection (were emitted by `RxBleDevice.establishConnection()`). After `1.3.0` only errors raised in `RxBleRadioOperationConnect` and recieved by `BluetoothGattCallback.onConnectionStateChange()` were closing the connection so it was possible that `DeadObjectException`s raised repetedly by subscribing to i.e. `RxBleConnection.readRssi()` would not close the connection. Added monitoring of BluetoothAdapter’s state to prevent `DeadObjectException`s and inform the user about the connection loss as soon as possible.
`DeadObjectException` is usually thrown when interacting with `BluetoothAdapter` or `BluetoothGatt` instance that was obtained before bluetooth being turned off. Prior to library version `1.3.0` all errors raised when interacting with `BluetoothGatt` or recieved by `BluetoothGattCallback` were closing the connection (were emitted by `RxBleDevice.establishConnection()`). After `1.3.0` only errors raised in `RxBleRadioOperationConnect` and recieved by `BluetoothGattCallback.onConnectionStateChange()` were closing the connection so it was possible that `DeadObjectException`s raised repetedly by subscribing to i.e. `RxBleConnection.readRssi()` would not close the connection. Added monitoring of BluetoothAdapter’s state to prevent `DeadObjectException`s and inform the user about the connection loss as soon as possible. Moved responsibility of checking the BluetoothAdapter’s state from Connector to DisconnectionRouter to have it in one place.
@hoanglm4 I have just pushed a new version of Edit: it is a new |
Dear @dariuszseweryn , thank you so much. I will check your fixed in tomorrow (currently, my country in midnight, so I don't have device for check it) |
Dear @dariuszseweryn, Version: 1.3.4-SNAPSHOT Note: I using 1.3.3, this issue is not occur |
…278) `RxBleConnection` can be instantiated only after `BluetoothGatt` is available. Changed the Connector code from `Observable.just(connectionComponent.rxBleConnection()` to `Observable.fromCallable(connectionComponent::rxBleConnection)` equivalent.
@hoanglm4 my bad — just pushed a fix. There should be a new version of |
Dear @dariuszseweryn, I have tested this issue. "DISCONNECTED" state is shown when bluetooth is crashed. I think your fixed is OK. Thanks |
I am happy to hear that. :) Thank you for your report. |
@hoanglm4 I have just released an official |
…ConnectOperation` will finish (#275) (#278) The `RxBleConnection` needs `BluetoothGatt` to be created. The `BluetoothGatt` is available only after the `ConnectOperation` will call `BluetoothDevice.connectGatt()` or `BluetoothGattCallback.onConnectionStateChange()` will be called whichever comes first.
Dear @dariuszseweryn, Thanks |
I will probably try to release it tomorrow. |
FYI—it is released. |
Great! Thank you so much :) |
I am afraid that this has nothing to do with the library judging by the stacktrace. |
Okay I am going to remove it |
I have seen this exception happening on some low end Android phones when calling gatt.disconnect method |
Summary
CONNECTED state forever when BluetoothGatt: android.os.DeadObjectException is thrown
My code in below:
Actual result
BluetoothGatt: android.os.DeadObjectException is thown
Please see log:
Expected result
When BluetoothGatt: android.os.DeadObjectException is thrown => call disconnect and shown DISCONNECTED state
Library version
1.3.3
The text was updated successfully, but these errors were encountered: