Skip to main content
This page takes you from an empty React Native app to a 60-second reading that returns heart rate, HRV (RMSSD), SDNN and breathing rate on a phone. The React Native sample app shows every step in one App.tsx.

Prerequisites

  • An iPhone on iOS 15 or later, or an Android 9 (API 28) or later phone. Simulators and emulators cannot take a reading.
  • React Native 0.86 or newer (New Architecture) and Android minSdkVersion 28.
  • Xcode 27 or newer, which needs the UIScene life cycle (Requirements). The React Native 0.88 template has it. On 0.86 or 0.87, use the sample app’s AppDelegate.swift with your module name, and add its UIApplicationSceneManifest to your Info.plist.
  • Expo: Expo Go cannot load the native module, so use a development build.
  • From NEUROFIT: a license key and a download token. The key lists every bundle identifier you run, development ones included (Debug builds).
  • The pre-built flow ships in English (localize it).

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/build.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/<YourApp>/Info.plist. Android needs nothing: the package’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 Metro, because release builds refuse that key (Debug builds).

Option A: pre-built reading flow

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). It locks portrait on Android. On iOS, restrict your app’s orientations (Orientation and screen).

Option B: your own screens

Ask for camera access, subscribe to events, then call start() (Starting a session).
useReading.ts
To show the camera, mount VitalsCameraPreview and start once it is ready (Camera preview rules). ReadingOverlay is your view that calls useReading.
The hook calls stop() on unmount. 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.