-
Notifications
You must be signed in to change notification settings - Fork 442
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
[Feature]: iOS Core Bluetooth Background Processing support #846
Comments
feel free to create new PRs and test them |
FYI there was a https://github.com/espresso3389/flutter_blue fork of the original pauldemarco I'll need some foreground support as well in my app at some point - highly requested -, however this seems to be a major undertaking in my case. More specifically at my app level this looks to be a significant architectural change. Even though there are plugins such as https://pub.dev/packages/flutter_foreground_task/ you can see it's unfortunately not a simple yaml include and a plop in of a code snippet: it's a detailed 5+ step staged procedure. I also don't see a way - once I convert my app - to have that functionality be optional. That's important because if such function would be at the FBP plugin level, it could happen not everyone would want it: because for example it needs extra manifest declarations, you'd need to select type of service, extra permission shenanigans, declaring callbacks, and the list goes on and on. But ultimately I'd need to tackle this as well for user request. I wonder if it's even doable at FBP level, it'll be hard enough at app level. I'm curious what is your use-case and plans. |
My initial testing with the app in the background, using a 15 second keep awake ping, kept my app open. |
What type of keep awake ping are you talking about? Like a characteristic value change? |
Yeah. Having a characteristic value change wakes the app for 10-15 seconds. If you do this enough the app stays open. The device I connect to uses 2 characteristics for a read/write command setup so I just sent ping which gets a response. |
@chipweinberger are there any updates on this? I absolutely need this feature! Otherwise, I have to completely rebuild my app in a different language with a different framework. Can someone please implement IOS BLE State Restoration. |
I don't need this feature, so I wont be working on it. If you really don't want to implement it yourself, I could implement it for you, but for a fee. email me if interested. |
BLE State Restoration and background services are two different things, although may not be completely unrelated: in case the the background service gets yeeted (this part of Android is not standardized https://dontkillmyapp.com/) then restoration may come into play? |
I think Chip did some work related to reconnection if I'm not mistaken, however BLE State Restoration sounds more formal. |
there was this nearly complete PR recently |
I've pushed this commit (12c17a6) , which should enable this feature. But I have not been able to get it to work in actual testing.
If anyone else wants to try it, please do, and report back. To use it, just call FlutterBluePlus.setOptions, like this
You also need to update the info.plist
|
released version 1.32.13 with State Preservation |
I made some minor tweaks using your latest update and was able to get it to restore the CBCentralManager and peripherals. Additionally I created a restoration state that tells the app whether or not it was restored or the initial start. This may be useful for diverging behaviors, but not technically required. |
awesome! i look forward to the PR! |
FlutterBluePlus Version
1.31.17
Flutter Version
3.19.3
What OS?
iOS
OS Version
17
Bluetooth Module
nordic nRF52832
What is your feature request?
It would be nice to support iOS core bluetooth background execution mode as described here: https://developer.apple.com/library/archive/documentation/NetworkingInternetWeb/Conceptual/CoreBluetooth_concepts/CoreBluetoothBackgroundProcessingForIOSApps/PerformingTasksWhileYourAppIsInTheBackground.html.
I believe there is a PR for flutter_blue that was never merged: pauldemarco/flutter_blue#191 and pauldemarco/flutter_blue#210.
Logs
The text was updated successfully, but these errors were encountered: