Home

Awesome

nRF Blinky for Android

nRF Blinky is an application targeting an audience of developers who are new to Bluetooth Low Energy.

The app can be easily converted to work with other devices and may act as a template app.

This very simple application contains two basic features:

Scanner Blinky

It demonstrates how the BleManager class from Android BLE Library library can be used from a View Model (see Architecture Components).

Structure

The new version of nRF Blinky application has been created in Jetpack Compose.

Dependencies

It is using the following libraries:

The gradle script was written in Kotlin Script (gradle.kts) and is using version catalog for dependency management.

Modules

The application consists of the following modules:

The :blinky:ui and :blinky:spec modules are transport agnostic. The Bluetooth LE transport is set using Hilt @Binds dependency injection here.

The app is based on :navigation module from the Nordic Common Library, which is using NavHost under the hood, and adds type-safety to the navigation graph.

Each screen defines a DestinationId (with input and output types) and NavigationDestination, which declares the composable, inner navigation or a dialog target. See BlinkyDestination for an example.

Navigation between destinations is done using Navigator object, available using Hilt form a ViewModel. When a new destination is selected, the input parameters are available from SavedStateHandle (see BlinkyModule class).

Nordic LED and Button Service (LBS)

Service UUID: 00001523-1212-EFDE-1523-785FEABCD123

A simplified proprietary service by Nordic Semiconductor, containing two characteristics:

For documentation for nRF5 SDK, check out this link and for one based on nRF Connect SDK this link.

Requirements

Installation and usage

Program your device with LED Button sample from nRF5 SDK (blinky sample) or nRF Connect SDK (LBS sample).

The device should appear on the scanner screen after granting required permissions.

Required permissions

On Android 6 - 11 nRF Blinky will ask for Location Permission and Location services. This permission is required on Android in order to obtain Bluetooth LE scan results. The app does not use location in any way and has no Internet permission so can be used safely.

This permission is not required from Android 12 onwards, where new Bluetooth permissions were introduced. The BLUETOOTH_SCAN permission can now be requested with usesPermissionFlags="neverForLocation" parameter, which excludes location related data from the scan results, making requesting location not needed anymore.