Legacy Android SDK
2.2.2
2.2.2
  • Introduction
  • Requirements
  • Downloading
  • Setup
  • Initialization
    • Network Security Settings
  • User Management
    • Create User
    • User status
    • Delete engine enrol
    • Delete User
  • Face Engine
    • Liveness Detection
      • Liveness Customisation
    • Face Verification
    • Camera Helper
  • Voice Engine
    • Initialization
    • Audio Recording
    • Recording Submission
  • Document Engine
    • Validate document
    • Validate entity template
    • Validate entity
  • Enums
Powered by GitBook
On this page
  • Example XML implementation
  • Method
  • Callback
  • Basic implementation
  1. Face Engine

Liveness Detection

In order to verify the authenticity of a user, Biometrid's liveness engine expects the end-user to perform some basic interactions with the device in hand.

The android version of the SDK requires the developer to create a basic view where the liveness detection surface will be shown.

Example XML implementation

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <FrameLayout
        android:id="@+id/detection_surface"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

</RelativeLayout>

Method

BiometridAuthFace.getInstance().startLivenessDetection(
    String biometrid_id,
    LivenessCustomisation customisation, 
    AuthFaceCallback context
);

startLivenessDetection

method

String biometrid_id

String biometrid id

LivenessCustomisation customisation

Object

AuthFaceCallback context

Applicational context

The result of the verification will be shown on the callback as represented below.

Callback

@Override
public void livenessDetectionResult(boolean status, final String photo, String template, final Errors error) {
    if(!status && error != null) 
        Log.e("error", error.getMessage());
    else {
        Log.i("Photo" + photo + " Face map" + tamplate);
    }
 }

livenessDetectionResult

callback

boolean status

Request status

String photo

Photo in base64

String template

Facemap in base64

Errors errors

Error object

Basic implementation


public class ExampleActivity extends Activity implements AuthFaceCallback {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_example);

        BiometridAuthFace.getInstance()
        .startLivenessDetection("biometrid_id", null, this);
    }

     @Override
    public void livenessDetectionResult(boolean status, String photo, String template, Errors errors) {
        Log.d("ExampleActivity", "livenessDetectionResult: status: " + status + " photo: " + photo + " tamplate: " + template);
 
        if(errors != null) {
            Log.d("ExampleActivity", "livenessDetectionResult: error: " + errors.getMessage());

        }
    }

    ...
}

For more information on this technology please contact us

PreviousFace EngineNextLiveness Customisation

Last updated 4 years ago