Open xandros6 opened 4 years ago
I'll see about fixing it, but you can call BleManager.bluetoothState()
to check if it's enabled or BleManager.observeBluetoothState()
to monitor the state.
From what I see the adapter is returning an error if you're trying to enable an enabled radio. https://github.com/Polidea/MultiPlatformBleAdapter/blob/master/android/library/src/main/java/com/polidea/multiplatformbleadapter/BleModule.java#L1188
The returned error has error code: BleErrorCode.BluetoothStateChangeFailed (105). Can you surround your call to enable with try/catch and confirm that it really is stuck and not just terminating the rest of the flow because of an uncaught error?
BleErrorCode.BluetoothStateChangeFailed is not emitted, so I use BleManager.bluetoothState() as you suggest.
Thanks!
Oh! It should be emitted! I'll use this issue to track it, if you don't mind? I'll have to fix it sometime.
Hi, version 2.2.4, on Android 6.0.1 API level 23 (Sony Xperia Z3 Compact) With Bluetooth already eanbled. on code:
the call to _bleManager.enableRadio() never finish. If Bluetooth is previously disabled it works.
As a workaround, I can every time disable and enable the radio, but I think there is a better way.
Thanks.