-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't initialize CBCentralManager until needed #599
base: master
Are you sure you want to change the base?
Conversation
By deferring the initialization of `CBCentralManager`, we are able to defer prompting for Bluetooth permission on iOS until a flutter_blue method is called. Otherwise, the Bluetooth permission prompt appears right when the app starts up.
This is really important for any production app that wants a reasonable user experience! |
You saved my life! |
@pauldemarco do you have any opinion on this pull request? |
For those who want to use this PR before it is merged: dependencies:
flutter_blue:
# TODO: revert to official version of flutter_blue when this is merged: https://github.com/pauldemarco/flutter_blue/pull/599
git:
url: https://github.com/tidbyt/flutter_blue.git
ref: 4ed5e9980139a9521fcd4dcdd7a97084875bb7b6 And of course don't forget to subscribe to this PR. |
revert to official version of flutter_blue when this is merged: pauldemarco#599
pauldemarco#599 Don't initialize CBCentralManager until needed
@rohansingh This PR has the unfortunate side effect where calling As a workaround, I just added a small delay between the |
@jasaw Did you insert the delay in FlitterBluePlugin.m? Can you share the implementation? |
By deferring the initialization of
CBCentralManager
, we are able todefer prompting for Bluetooth permission on iOS until a flutter_blue
method is called. Otherwise, the Bluetooth permission prompt appears
right when the app starts up.