Alex MitrovicBLE & IoT app developer, Android and iOS

Connected device · Android

Owning a production BLE stack

A connected-device product needed one person to own its Android BLE layer: device state, error recovery and every flow where a dropped connection meant a failed user action.

Client
Connected-device company (NDA)
Role
Senior Android engineer, BLE stack owner
Platform
Android, Kotlin, Coroutines, Flow
Team
Android, iOS, backend, embedded
A phone and a row of identical small Bluetooth sensors on a deskOne appMany devices

In short

What did I do?

I became the primary owner of the Android BLE layer of a connected-device product. I documented the architecture, rebuilt state handling and error recovery with Kotlin Flow, improved field diagnostics and extracted the core into a dedicated Android SDK.

KotlinCoroutinesFlowBluetoothGattAndroid SDKBLE

Problem

The BLE code had grown with the product. State handling and error processing were spread across the app, which made connection problems hard to diagnose and risky to change. New developers needed a long time to understand it.

Add the concrete symptom, e.g. "users saw the device go offline after X minutes" or "support tickets about failed pairing".

Approach

  • Mapped and documented the existing architecture, so the team could onboard and change it safely.
  • Refactored the Kotlin/Flow-based state handling and error processing, with clear connection states and recovery paths.
  • Improved diagnostics, so field failures came with logs that explained them.
  • Extracted the core functionality into a dedicated Android SDK, which reduced coupling and improved build performance.
  • Worked through mobile-to-device integration issues together with the iOS, backend and embedded teams.

Under the hood

What it took

The core change was making connection state explicit: one state per device, exposed as a StateFlow, with every transition and its cause in one place instead of flags spread across screens. Errors became values with a recovery path, not exceptions caught somewhere in the UI.

Once the BLE core had one clear interface, moving it into its own Android SDK module followed naturally: the app depends on the SDK's API, and the BLE internals can change without touching screens. It's the pattern described in the GATT operation queue and connection drops.

Result

Add numbers you can share, e.g. "connection success rate 78% → 99%", "BLE-related crash reports down X%", "reconnect time from X s to Y s".

A BLE layer with one owner, clear states and documentation the rest of the team can work from.

What I'd do the same way again

Document before you refactor. The architecture map made every later change safer, and it's what let new developers work on the BLE code at all.

Similar problem on your device?

Tell me what's breaking. No pitch deck needed.

Book a free call

Free · NDA on request · reply within 1–2 working days