Skip to content

Android SDK Overview

View on GitHub

vitallens-android is the official Kotlin SDK for the VitalLens API, a service for estimating physiological vital signs from facial video.

The library provides:

  • High-Fidelity Accuracy: A simple interface to the VitalLens API for state-of-the-art estimation (heart rate, respiratory rate, HRV).
  • Drop-in UI Components: Ready-made Jetpack Compose screens (ScanScreen, MonitorScreen) for instant integration into your app.
  • Live Camera Input: Support for live Android camera streams via CameraX.
  • Fast Face Detection: Native face detection and ROI management using Google's ML Kit.
  • Pluggable Architecture: Built on a strategy pattern, allowing you to swap the remote API backend for your own on-device model (TFLite, ONNX Runtime, or anything else).

Using a different language? Check out our Python client, JavaScript client, or iOS client.

Installation

Add the dependency to your module's build.gradle.kts:

dependencies {
    implementation("com.rouast:vitallens-ui:0.1.0")
}

Select the artifact you need:

  • vitallens-ui: Pre-built Jetpack Compose screens, plus everything below (Recommended).
  • vitallens: Camera, face detection, and client logic โ€” no pre-built UI, plus everything below.
  • vitallens-inference: Pure logic and math. No camera or UI dependencies.

Quickstart

Note: The Android SDK requires a valid API key to process video. You can get a free key from the API Dashboard.

The fastest way to get started is using the pre-built 30-second Scan screen in Jetpack Compose:

import androidx.compose.runtime.Composable
import com.rouast.vitallens.ui.ScanScreen

@Composable
fun MyScanScreen() {
    // Automatically selects the best model for your plan
    ScanScreen(
        apiKey = "YOUR_API_KEY",
        method = "vitallens",
        onComplete = { result ->
            // Handle the final result
            result.heartRate?.value?.let { hr ->
                println("Final Heart Rate: $hr bpm")
            }
        },
    )
}

Note: Remember to declare the android.permission.CAMERA permission in your app's AndroidManifest.xml, and request it at runtime before showing ScanScreen/MonitorScreen.

Next Steps

Now that you have the client installed, explore the detailed guides:

Requirements

  • Android 8.0+ (API level 26+)
  • Camera Permission: Declare android.permission.CAMERA in your AndroidManifest.xml and request it at runtime.

Disclaimer

vitallens-android provides vital sign estimates for general wellness purposes only. It is not intended for medical use. Always consult with your doctor for any health concerns or for medically precise measurement.

See also our Terms of Service for the VitalLens API and our Privacy Policy.

License

This project is licensed under the MIT License.