Most Bluetooth companion apps are designed as if the device sits on the desk next to the phone. Ours was for a smart dog harness, and the first thing we learned is that the phone and the harness are apart for most of the day. The owner walks out the front door and the dog stays home.

This post shares the decisions that mattered most while our engineer Mihir Shingala built the iOS app. The full write-up, with the project facts and an FAQ, is in our smart dog harness BLE companion app case study.

1. Design the server route first

If an app only really works over Bluetooth Low Energy, it is broken for most of the hours the owner has it. And the owner will not blame the phone. They will blame the hardware.

So the rule we would give any team building a BLE companion app:

  • Bluetooth is the fast path when it happens to be there.
  • The server route is the normal path, and it gets designed first, even if it ships second.
  • Both routes write to the same history, so the user sees one list and never learns which route a command took.

In our app, the harness reports its own Wi-Fi state inside the status it sends over Bluetooth. That is how the app knows which route to pick without asking the user anything.

2. Every message must know what reply it expects

Our first version started a 60 second timeout on every Bluetooth write, and any reply cleared it. That works for almost every command.

It does not work for "play this recording on the harness", because the firmware only replies when it cannot find the file. Success is silence. So a play that worked looked like a failure, the timer fired a minute later, and it cleared the callbacks for every screen at once. Nothing crashed. The screens just stopped updating, which made it slow to find.

The fix: each action carries its own reply rule. Some expect a reply, some expect a reply only on failure, and those get no timer at all.

3. Streamed voice needs a strict definition of "finished"

The AI chat streams text and voice in one response, one small JSON message per line, so the voice starts before the answer is complete.

Our first audio player stopped the moment its buffer ran empty. When audio arrived slower than it played, the voice cut out mid sentence while the rest of the answer was still on its way.

Playback now ends only when two things are true: the stream has finished, and every audio chunk that arrived has played. An empty buffer on its own means wait.

4. Save device data on the phone first

Data from the harness is saved on the phone, acknowledged back to the harness, and uploaded later in batches through an iOS background session. A bad network should never block the device.

One thing we would change: the app acknowledges a record when the save starts, not when it finishes. That leaves a small gap where the harness thinks a record is safe and the phone never stored it. Small gaps like this are cheap to fix early and painful to fix later.

What we would do differently

  • Add Bluetooth state restoration from day one. Without it, an iOS background shutdown ends the connection until the user opens the app.
  • Give each message its own timeout rule from the start, instead of one shared timer.
  • Test every firmware change on test firmware and log every message the app sends. When the docs and the device disagree, the log shows you which side is wrong.

If you are building a companion app for Bluetooth hardware, a pet wearable, a fitness tracker or a home sensor, the case study covers the file transfer protocol, the WebSocket fallback and the costs in more detail. We also write about this kind of work on our IoT app development page.

Written by the Mobilions team, based on the engineering notes of Mihir Shingala, Full Stack Mobile Developer.