flutter-rx-ble
flutter-rx-ble copied to clipboard
[iOS] State Preservation and Restoration
My application is managing a BLE object and I need to manage all cases regarding connection. A great article is describing the pb here: https://uynguyen.github.io/2018/07/23/Best-practice-How-to-deal-with-Bluetooth-Low-Energy-in-background/
and Apple article: https://developer.apple.com/library/archive/documentation/NetworkingInternetWeb/Conceptual/CoreBluetooth_concepts/CoreBluetoothBackgroundProcessingForIOSApps/PerformingTasksWhileYourAppIsInTheBackground.html#//apple_ref/doc/uid/TP40013257-CH7-SW10
I do not see how the current library is managing State Preservation and Restoration.
Can you please help ?
What would be fine:
- Allow to set an identifier when creating the centralManager:
myCentralManager =
[[CBCentralManager alloc] initWithDelegate:self queue:nil
options:@{ CBCentralManagerOptionRestoreIdentifierKey:
@"myCentralManagerIdentifier" }]
- add a "callback" when the restoration is fired with devices and states :
- (void)centralManager:(CBCentralManager *)central
--
willRestoreState:(NSDictionary *)state {
NSArray *peripherals =
state[CBCentralManagerRestoredStatePeripheralsKey];
Hi guys, any updates on this? This would be a useful feature
@fvisticot tks fo the articles
Hi @valtbarbos I'm currently tackling a similar issue in my own project. Curious what your solution ended up being?
Hi @valtbarbos I'm currently tackling a similar issue in my own project. Curious what your solution ended up being?
Im using another library.
https://github.com/valtbarbos/flutter_blue/tree/master
here an example of background and auto reconnection, tested with iOS 13.1 https://github.com/valtbarbos/flutter_blue/commit/651b121855d64630013a1250c7a790c7a88afd52
I hope it is useful.