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.
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
Copy the SDK (
libfacesdkfolder) to therootfolder in your project. Placefacelivenessdk.aarfrom Google Drive insidelibfacesdk/.Add SDK to the project in
settings.gradle
Add dependency to your
build.gradle
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
Contextlicense (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
Place
facelivenessdk.aarinlibfacesdk/(see Setup).Keep the demo package name
com.faceplugin.faceliveness.Run on a physical phone.
Home tiles: Liveness, Settings, About. The demo does not enroll people or run 1:N search.
Screenshots




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.
Related documentation
Last updated