dotintent / FlutterBleLib

Bluetooth Low Energy library for Flutter with support for simulating peripherals
Apache License 2.0
531 stars 195 forks source link

Adding options to show Bluetooth power alert (when bluetooth is power off from control panel) #576

Closed miguel-hyve closed 3 years ago

miguel-hyve commented 3 years ago

I have a requirement on an app and need to differentiate between 3 states:

I have not found the way to handling the third state with the current code, but adding the option CBCentralManagerOptionShowPowerAlertKey on BluetoothManager constructor, the alert it's shown at the beginning

Are you thinking to add this option?

Thanks a lot!

image

IMG_D1A4689FB9BA-1

mikolak commented 3 years ago

CBCentralManagerOptionShowPowerAlertKey is responsible for showing automatic system alert to the user that they have Bluetooth turned off when creating the BLE manager. Unless you're destroying the client then and trying to recreate it every x seconds, I imagine you'd be better off implementing an alert dialog showing the user how to reenable BT and monitoring the state of the adapter, as the user will not be warned if they turned BT off after the manager was created.

This might also be an undesired behaviour, so it'd require quite a lot of API work to let the developer tell whether they'd like it or not.

Perhaps if it gets enough traction in the future? Not really considering it now, as it seems as a really low priority.