$ show nordicsemi/Android-nRF-Blinky
This is a high-quality Android sample application from Nordic Semiconductor that demonstrates Bluetooth Low Energy (BLE) connectivity using the Kotlin BLE Library. The app connects to a peripheral implementing the LED Button Service (LBS), allowing users to toggle an LED and detect button clicks and long presses. It features a modular architecture with separate modules for the device specification (transport-agnostic), BLE transport implementation, UI, and scanner. The app uses Jetpack Compose for UI, Hilt for dependency injection, Navigation 3 for navigation, and a foreground service for background operation. It includes both a native flavor for real BLE hardware and a mock flavor for testing without physical devices. The codebase is well-structured, follows modern Android best practices, and serves as a reference for building BLE apps with the Nordic BLE library.
The LLM identified 2 files worth highlighting for reuse:
Defines the Blinky interface and State interface, which abstract the BLE device operations (connect, LED control, button events) from the transport layer. This module has zero Android dependencies and can be reused in any project needing a generic BLE device API. The interface is clean, uses Kotlin flows, and includes a toggle extension function.
A simple factory interface for creating Blinky instances, decoupling the UI from the BLE implementation. This pattern allows the app module to inject different implementations (native or mock) without the UI module knowing the transport details. It is a clean, reusable abstraction for any multi-module Android app that needs to swap implementations.