flutter_blue icon indicating copy to clipboard operation
flutter_blue copied to clipboard

Delay Bluetooth permission & turn-on-Bluetooth system popups on iOS

Open jasaw opened this issue 4 years ago • 2 comments

PR #599 delays centralManager initialization, but instantiating FlutterBlue in flutter calls into _setLogLevelIfAvailable() which calls into isAvailable and triggers a popup anyway. This PR skips isAvailable call in the FlutterBlue constructor and allows setting of log level without initializing centralManager. The side effect of this change is, for some reason, Bluetooth permission always returns "denied" until centralManager is initialized. Similarly, Bluetooth permission under App Settings does not appear until centralManager is initialized.

jasaw avatar Oct 18 '21 06:10 jasaw

This PR has the unfortunate side effect where calling isOn always returns false if centralManager is initialized in the same call. This is caused by race condition of reading the Bluetooth state while the Bluetooth subsystem is still initializing.

jasaw avatar Oct 25 '21 13:10 jasaw

The bug is still being reproduced even in the master branch

politebarista avatar Feb 14 '23 12:02 politebarista