blessed-android-coroutines
blessed-android-coroutines copied to clipboard
fix: Fixed bluetooth manual disconnection when bluetooth is back in the second
Fix this :
05-25 18:28:58:019 D/BluetoothCentralManager(2) : bluetooth turning off
05-25 18:28:58:029 W/BluetoothPeripheral(1533) : cannot cancel connection because no connection attempt is made yet
05-25 18:28:58:389 D/BluetoothCentralManager(2) : bluetooth turned off
05-25 18:28:58:823 D/BluetoothCentralManager(2) : bluetooth turning on
05-25 18:28:59:121 D/BluetoothCentralManager(2) : bluetooth turned on
05-25 18:28:59:390 E/BluetoothCentralManager(2) : bluetooth turned off but no automatic disconnects happening, so doing it ourselves
05-25 18:28:59:391 D/BluetoothCentralManager(2) : disconnect all peripherals because bluetooth is off
Hi, so the issue is that because I use the timer, there is a 1 second window for things to go wrong. However, with your fix, the peripheral might still not be disconnected. I think we should make sure that peripherals always get disconnected when switching off bluetooth.
Doing so experimentation and now I am considering removing the timer completely and simply call cancelAllConnectionsWhenBluetoothOff()
when bluetooth is turning off. What do you think?
Hi @weliem
If you think that removing the timer will not cause regressions, i vote for it. 👍
I have removed the timer and made a new release (0.3.1). Please have a look if that causes any regressions. I did some testing on several phones that I have and it seems to work fine.