For the complete documentation index, see llms.txt. This page is also available as Markdown.

Android

Faceplugin Face Liveness Detection Android SDK. On-premise PAD against photos, screens, masks, and deepfakes. AAR, setActivation, init, faceDetection, detect.

Fully on-premise Face Liveness SDK for Android (presentation-attack detection). The demo does not enroll people or run 1:N search. It scores whether the face is real.

What
Id

Android demo package name

com.faceplugin.faceliveness

Public Java class

com.faceplugin.facelivenesssdk.FaceLivenessSDK

Keep the demo package name com.faceplugin.faceliveness so the sample key works.

Code

Setup

  1. Copy the SDK (libfacesdk folder) to the root folder in your project. Place facelivenessdk.aar from Google Drive inside libfacesdk/.

  2. Add SDK to the project in settings.gradle

  1. Add dependency to your build.gradle

  1. minSdk 24, useLegacyPackaging = true, CAMERA permission. Call setActivation → init on a background thread.

Status codes: 0 Success, 1 Invalid license, 2 Expired, 3 Not activated, 4 Init failed.

APIs

setActivation: This API is used to activate the SDK

Input

  • context (Context): Android Context

  • license (String): The license string (license key)

Return value

The SDK activation status code.

  • 0: Success

  • 1: Invalid license

  • 2: Expired

  • 3: Not activated

  • 4: Init failed

init: This API is used to initialize the SDK

getMachineCode: This API is used to retrieve the machine code

getLicenseStatus: This API is used to read license status

Use allowsLiveness() before Capture.

faceDetection: This API is used to detect faces and determine if the faces are real or fake

Input

  • bitmap (Bitmap): The Bitmap image

  • param (FaceDetectionParam): Parameters for face detection

Return value

A list of FaceBox objects representing the detected faces and their liveness scores.

FaceDetectionParam

FaceBox

The liveness score ranges from 0.0 to 1.0. If it's greater than the threshold, it's real face. Demo default threshold is 0.5.

detect: This API is used to detect faces and return engine JSON

detect requires a liveness-capable license.

VideoWorker: This API is used for the live camera HUD

The demo does not enroll. VideoWorker match DB is empty. Use it to keep a live track while you still score with faceDetection:

startVideoWorker → addVideoWorkerFrame → stopVideoWorker.

deinit: This API is used to unload the engine

Run the demo

  1. Place facelivenessdk.aar in libfacesdk/ (see Setup).

  2. Keep the demo package name com.faceplugin.faceliveness.

  3. Run on a physical phone.

  4. Home tiles: Liveness, Settings, About. The demo does not enroll people or run 1:N search.

Screenshots

Home
Liveness
Settings
About

Faceplugin Face Liveness Android home

Faceplugin Face Liveness live camera

Faceplugin Face Liveness settings

Faceplugin Face Liveness About

License

Licenses are offline. Request a new license key for your own app. Use allowsLiveness() before Capture.

Try it (after the demo compiles)

Request a License & Support · Contact us

FAQ

Passive or active? Passive anti-spoofing. Score the camera frame; no smile / turn-head challenge on this product.

Threshold? Treat 0.5 or higher as Real / pass unless Faceplugin support gives you a different recommended threshold.

Last updated