Skip to content

Conversation

@kwiky
Copy link

@kwiky kwiky commented May 31, 2022

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

@weliem
Copy link
Owner

weliem commented Jun 1, 2022

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?

@kwiky
Copy link
Author

kwiky commented Jun 10, 2022

Hi @weliem

If you think that removing the timer will not cause regressions, i vote for it. 👍

@weliem
Copy link
Owner

weliem commented Jun 28, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants