Skip to main content
This page takes you from an empty app to a 60-second reading that returns heart rate, HRV (RMSSD), SDNN and breathing rate on an Android phone.

Prerequisites

  • An Android phone on Android 9 (API 28) or later. The emulator cannot take a reading.
  • minSdk 28, JVM 17, and Kotlin 2.1 or newer if your app uses Kotlin.
  • From NEUROFIT: a license key for your application id (Debug builds) and a download token.
  • The pre-built flow ships in English (localize it).

Install

settings.gradle.kts
~/.gradle/gradle.properties
app/build.gradle.kts
In Groovy (settings.gradle), write credentials(PasswordCredentials) and content { includeGroup 'com.neurofit' }, with url = 'https://sdk.neurofit.app/maven'. vitals-sdk-ui brings Jetpack Compose (BOM 2026.06.01). On CI, see Download token. Offline builds, your own repository or a source license: Install from source or manually.

Camera usage

The AAR declares CAMERA and marks the camera and flash optional, so there is nothing to add (Manifest). The SDK needs no other permission.

Activate

Put the key in ~/.gradle/gradle.properties as NEUROFIT_VITALS_LICENSE_KEY=<your license key>, out of git, and pass it to BuildConfig:
app/build.gradle.kts
activate throws LicenseInvalid with a reason (reasons and fixes). A debuggable build also accepts a key that does not list your application id, then returns and logs a warning, because release builds refuse that key (Debug builds).

Option A: pre-built reading flow

In Compose, show the VitalsReadingFlow composable as a full-screen destination with no app bar:
  • The flow checks the device and asks for camera access itself, so you don’t need to request it first.
  • One of onComplete, onCancel, onError fires when the user leaves the flow (callbacks and options).
  • The Activity shows full screen in portrait by itself. The composable locks portrait while shown. On large screens Android may ignore that lock, so declare configChanges on the activity that hosts the composable (Orientation and screen).

Option B: your own screens

Ask for camera access, subscribe to events, then call start() (Starting a session).
Call stop() when the screen goes away, lock portrait and keep the screen on (Orientation and screen). Every event: Reading lifecycle.

Save the result

From Java: result.getHeartRateBpm(), getRmssdMs(), getSdnnMs(), getBreathingRateBrpm() (nullable) and getBreathingRateConfidence(). Formats and storage: Result JSON. Display rules: Presenting the numbers.