Android
Faceplugin Face Recognition Android SDK. Fully on-premise face matching, 1:N identify, and 2D liveness. AAR, setActivation, init, faceDetection, VideoWorker.
Fully on-premise Face Recognition SDK for Android. Detect faces, extract templates you store yourself, match 1:1 or live 1:N, and check passive 2D liveness on the device. Images never leave the phone.
Public class: com.faceplugin.facerecognitionsdk.FaceRecognitionSDK. Demo tiles: Enroll, Identify, Capture, Attribute, Settings, About.
Code
Setup
Copy the SDK (
libfacesdkfolder) to therootfolder in your project. Placefacerecognitionsdk.aarfrom Google Drive insidelibfacesdk/(next tolibfacesdk/build.gradle).Add SDK to the project in
settings.gradle
Add dependency to your
app/build.gradle
Add camera / gallery permissions in
AndroidManifest.xml. Call setActivation → init on a background thread. Keep the demo package namecom.faceplugin.facerecognitionsdk. Request a new license key for your own app.
Status codes: 0 Success (SDK_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
Input
context (Context): Android
Context
Return value
The SDK initialization status code.
0: Success
1–4: see
setActivation
getMachineCode: This API is used to retrieve the machine code
Input
context (Context): Android
Context
Return value
Machine code string (for license requests).
getLicenseStatus: This API is used to read license status
Input
None
Return value
JSON status string.
faceDetection: This API is used to detect faces
Input
bitmap (Bitmap): The Bitmap image
param (FaceDetectionParam): Parameters for face detection
Return value
A list of FaceBox objects representing the detected faces.
FaceDetectionParam
Use FaceDetectionParam.allAttributes() when you want liveness, age, gender, emotion, and quality in one call.
FaceBox
The liveness score ranges from 0.0 to 1.0. If it is greater than the threshold, it is a real face. Demo default threshold is 0.5.
templateExtraction: This API is used to extract face template
Input
bitmap (Bitmap): The Bitmap image
faceBox (FaceBox): The bounding box of the detected face
Return value
A byte array representing the extracted template from the face. Store these in your database.
similarityCalculation: This API is used to calculate the similarity between two face templates
Input
feature1 (byte[]): The first face template
feature2 (byte[]): The second face template
Return value
A float similarity score. Demo Identify default threshold is 0.67.
similarity(byte[] feature1, byte[] feature2) is an alias of similarityCalculation.
detect: This API is used to detect faces and return engine JSON
Input
bitmap (Bitmap): The Bitmap image
crop (boolean): Whether to crop faces
flags (int): Bit flags (
DETECT_ALL,DETECT_LANDMARKS,DETECT_LIVENESS,DETECT_LIVENESS_ACCURATE, …)
Return value
JSON string (same idea as HTTP POST /api/detect).
quality: This API is used to run face image quality checks
match: This API is used to compare two photos (1:1)
extractFeature: This API is used to extract a template from a cropped face image
Also: cropFace(Bitmap, FaceBox), parseFeatureBytes(String json), yuv2Bitmap(...), estimatorStatusJSON().
setLandmarkMode: This API is used to set the landmark model
VideoWorker: This API is used for live 1:N identify
Call in this order: startVideoWorker → syncVideoWorkerDatabase(templates) → addVideoWorkerFrame → stopVideoWorker. Listen with setVideoWorkerEventHandler. Identify in the demo is passive 2D liveness plus VideoWorker.
Also: startVideoWorker(float matchThreshold), addVideoWorkerFrameRgb, addVideoWorkerFrameBgra, VideoWorkerConfig / ActiveLivenessConfig.
Input
Match threshold, enrolled templates, and camera frames.
Return value
Match events via the VideoWorker listener (JSON).
deinit: This API is used to unload the engine
Input
None
Return value
Status code. 0: Success.
Run the demo
Place
facerecognitionsdk.aarinlibfacesdk/(see Setup).Open the cloned repo in Android Studio.
Run on a physical phone (emulator is not recommended for camera / liveness).
Wait until the home status bar disappears. Then Enroll / Identify / Capture / Attribute unlock.
Keep the demo package name com.faceplugin.facerecognitionsdk so the sample key works.
Enroll
Enroll a person from a gallery photo (exactly one face) into the on-device database
Identify
Live 1:N camera match (stop on first hit) with 2D liveness
Capture
Oval coach capture → still with attributes → optional enroll
Attribute
Gallery analysis: landmarks, liveness, pose, quality, age, gender, emotion
Settings
Camera lens, identify / liveness / pose / eye-close thresholds
About
SDK name and license label
Screenshots



System requirements
Android
API 24 (7.0)
API 29 (10) or newer
ABI
arm64-v8a, armeabi-v7a
arm64-v8a
RAM
4 GB
6 GB or more
Camera
Front camera
720p or 1080p
Device
Physical device
Same
License
Licenses are offline. Keep the demo package name so the sample key works. For your own app, request a license.
Try it (after the demo compiles)
Integrate into your own app
You need libfacesdk/ (the AAR) and FaceRecognitionSDK. You do not need the demo Activities.
Copy
libfacesdkinto your project root and putfacerecognitionsdk.aarinside it.Wire Gradle as in Setup (
minSdk 24,abiFilters,useLegacyPackaging).Add CAMERA and photo-library permissions.
Request license key for your own app.
Optional: copy
app/.../kit/(FaceRecognitionClient) so you do not rewrite threading, CameraX, or VideoWorker.
Typical call order: setActivation → init → faceDetection → templateExtraction → store templates in your database → similarityCalculation or VideoWorker for live 1:N.
Request a License & Support · Contact us
FAQ
What APIs does this page ship? Java/Kotlin FaceRecognitionSDK.setActivation, init, faceDetection, templateExtraction, similarityCalculation, and VideoWorker Identify.
Offline / on-premise? Yes, after a license key bound to the demo app id (or your own id).
Identify threshold? Default 0.67. Mobile Identify includes passive 2D liveness.
Related documentation
Last updated