By Ed Yanosik, Mobile iOS Engineer at Orion Labs
When you’re using your Onyx to communicate, you expect it to work — no matter what.
For your device to function, the first step is making sure it stays connected to your phone and the Orion app over Bluetooth Low Energy. While your phone manages the Bluetooth connection, our app communicates with your Onyx device. This connection between our app and your device is essential for your Onyx to function properly.
At the same time, the iOS operating system must work to maintain your phone’s battery life. So if you haven’t used our app in a while (especially if you’ve been using other applications that require lots of resources), the app session will be terminated by iOS, which would then sever the connection to your Onyx.
Fortunately, we’ve put work into making everything work seamlessly when this happens — which is where CoreBluetooth State Restoration comes in.
With CoreBluetooth State Restoration, we hand off the connection to iOS when it terminates our application and let the operating system manage the connection for us while the app is in the “Not Running” state. By transferring the connection instead of breaking it, you won’t feel the shakes, hear the beeps, or see the lights that typically indicate that your Onyx has disconnected.
Next, when you push your Onyx to send a message, our app immediately launches in the background and iOS hands the connection back to us, at which point we send the message in its entirety. This handoff feature gives us a seamless behind-the-scenes link to your Onyx, without dropping the connection or interfering with your work.
CoreBluetooth State Restoration also takes over our reconnection scan, so even if you turn off your Onyx or walk away from your phone, the app relaunches as soon as you turn on your device or walk back into range.
In addition to lots of other work from our iOS and Onyx firmware teams, CoreBluetooth State Restoration is just one part of the bigger picture when it comes to keeping your Onyx connected and functional at all times.