Legacy Android SDK
2.2.1
2.2.1
  • 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
  • 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(
    int view_id, // refering to the id of the view mentioned above
    String biometrid_id,
    LivenessCustomisation customisation, 
    AuthFaceCallback context
);

startLivenessDetection

method

int id

View id

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, String path, , LivenessResultStatus liveness_status, Errors errors) {
    if(!status && serrors != null) 
        Log.e("error", error.getMessage());
    else {
        Log.i("File path", path);
    }
 }

authRecordAudioCallback

callback

boolean status

Request status

String path

Temp file absolute path

LivenessResultStatus

Liveness status enum response

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(R.id.example, "biometrid_id", null, this);
    }

    @Override
    public void livenessDetectionResult(boolean status, String file_path, LivenessResultStatus liveness_status, Errors errors){
        if(errors =! null){
            //handle erros
            switch(errors){
                case UNABLE_TO_WRITE_IN_FILE:
                     Log.e("error", errors.getMessage());
                break;
                ...
            }
        }
        else {
            /* This variable contains the path to a 
            temporary file.*/
            Log.i("path", path);
        }
    }

    ...
}

For more information on this technology please contact us

PreviousFace EngineNextLiveness Customisation

Last updated 4 years ago