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

Last updated