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

Prerequisites

  • An iPhone on iOS 15 or later, or an Android 9 (API 28) or later phone. Simulators and emulators cannot take a reading.
  • Capacitor 8, JDK 21, and Xcode 27 or newer, which needs the UIScene life cycle (Requirements).
  • From NEUROFIT: a license key and a download token. The key lists every bundle identifier you run, development ones included (Debug builds).

Install

Commit the file, and set NEUROFIT_DOWNLOAD_TOKEN in your shell and in CI. Then:
The package carries both native SDKs, so iOS and Android need no further repository. Set minSdkVersion = 28 in android/variables.gradle. Offline builds, your own repository or a source license: Install from source or manually.

Camera usage

Add the two keys from the iOS quickstart to ios/App/App/Info.plist. Android needs nothing: the plugin’s manifest declares CAMERA.

Activate

Read the key from your app’s config, kept out of git.
activate rejects with code licenseInvalid and a reason (reasons and fixes). An Android debug build also accepts a key that does not list your app id, then resolves a warning in warnings and prints it in the console, because release builds refuse that key (Debug builds).

Option B: your own screens

Capacitor has no pre-built flow, and a camera preview is on the Roadmap. Ask for camera access, subscribe to events, then call start() (Starting a session).
reading.ts
To leave early, abort the signal: runReading then rejects, cleans up and calls stop(). Lock portrait and keep the screen on (Orientation and screen). Every event: Reading lifecycle.

Save the result

Formats and storage: Result JSON. Display rules: Presenting the numbers.