Camera Helper

The android SDK also provides a camera object based on a library from google, to help test and implement facial verifications without our liveness engine.

Example XML implementation

It is required from the developer to create a basic view where the liveness detection surface will be shown.

<?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/camera_surface"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

</RelativeLayout>

Method

BiometridAuthFace.getInstance().startCamera(
  int id,
  Orientation orientation, 
  AuthFaceCallback context
 );

Implementation example

public class ExampleActivity extends Activity 
            implements AuthFaceCallback{

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

        BiometridAuthFace.getInstance().startCamera(
            R.id.camera_surface, 
            Orientation.Front, 
            this
        );
    }

    @Override
    public void onPictureTaken(boolean status, String filepath) {
        if(status){
            Log.i("filepath", filepath);
        }
    }

    ...
}

Last updated