Case study / 05 · Connected hardware · BLE
Running a Bluetooth device from a React Native app, with reconnects above 99%
At Babyation I led five developers on the React Native app people use to operate a Bluetooth-connected hardware device. The hard part was not the first connection. It was keeping the link alive in real life.
Context
The device is controlled from the phone: pair it, start and manage a session remotely, and see guidance tailored to the person using it. People also use more than one phone or tablet, so the data had to follow them.
Problem
The link kept dropping when the app went to the background. Re-subscription to the device was tied to a component mounting, so when the UI went away, so did the subscription, and the hardware and the app quietly fell out of step.
Approach
- Follow the hardware, not the UI. Re-subscription moved onto the BLE connection-state callback, with a bounded retry, so the app reacts to what the device is doing rather than to which screen is open.
- Stable pairing and remote control. Pairing and remote session control were built to survive backgrounding and flaky radio conditions.
- Data that follows the person. Firebase kept sessions in sync across devices, and GraphQL served the personalized guidance.
- Privacy by default. The app handles sensitive personal data, so storage and sync were designed with that in mind.
Result
- Reconnect success in the field went from flaky to consistently above 99%.
- Stable pairing and remote session control from the app.
- Sessions synced across a person's devices through Firebase.
What I took from it
Bind a hardware lifecycle to the hardware's own state. Anything tied to the UI lifecycle will break the first time someone locks their phone.