iOS BLE Restoration and Suspension State Mitigation #866
Scottie-Fischer
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I have been diving into the actual implementation of this package and see that in the iOS implementation there does not seem to be any handling of BLE restoration. To my understanding, this is useful when the app is constantly running in the background, the OS kills it for more important apps/tasks, and upon BLE communication it will restore the connection to the peripheral with the app still in the background. This seems like a super useful feature for the package as a whole.
This is done by setting a restoration key string in Central.swift file:
private var centralManagerRestoreID: String = "ReactiveBleRestoreId"
and using this string when initializing the CBCentralManager object
self.centralManager = CBCentralManager( delegate: centralManagerDelegate, queue: nil, options: [ CBCentralManagerOptionRestoreIdentifierKey: centralManagerRestoreID, CBCentralManagerOptionShowPowerAlertKey: true ] )
Then you implement willRestoreState function within the CentralManagerDelegate.swift
func centralManager(_ central: CBCentralManager, willRestoreState dict: [String: Any]){...}
If there is already this mitigation or other implementation, I would love if someone could point me towards that. If there is a better implementation to avoiding suspension mode I would also love to know.
Thanks for your engagement!
Beta Was this translation helpful? Give feedback.
All reactions