Only this pageAll pages
Powered by GitBook
1 of 34

3.0.0

Loading...

Standard SDK

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Full SDK

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Introduction

This library was created in order to make the implementation of Biometrid's technology quickly and straightforward on most applications.

Alongside the SDK, a sample app and credentials will be provided. This will demonstrate how the library features are supposed to be implemented.

This documentation is divided into six sections and will guide you through the implementation of Biometrid standard SDK.

The remaining sections detail each part of the framework.

The framework is developed in Java and Kotlin.

Enums

All Enums list and description

StepState

StepState

Description

CurrentStep

Enum to get current step info

CompletedSteps

Enum to get completed steps info

DocType

DocType

Description

File

Enum used to reference file documents

IdCard

Enum used to reference identification card documents

Passport

Enum used to reference passport documents

DriversLicense

Enum used to reference drivers license documents

Other

Enum used to reference other documents

Language

Language

Description

English

English language enum

Portuguese

Portuguese language enum

Spanish

Spanish language enum

Italian

Italian language enum

French

French language enum

ErrorMessage

ErrorMessage

Description

INTERNAL_SERVER_ERROR

Internal server error message

NO_INTERNET

Network unavailable message

NOT_INITIALIZED

SDK not initialized message

TypeError

TypeError

Description

DEFAULT

Default error type

LIVENESS_ERROR

Liveness error type

NFC_ERROR

NFC error type

AUTO_CAPTURE_ERROR

Auto Capture SDK error type

INTERNAL_SERVER_ERROR

Internal Server Error type

Gradle

Biometrid Standard supports Gradle for dependency management.

Added Build.gradle(module: app)

implementation 'com.biometrid:standard-android-sdk:3.0.0'
allprojects {
    repositories {
        google()
        mavenCentral()
        maven { url "https://dl.cloudsmith.io/public/biometrid/biometrid/maven/" }
        maven { url "https://dl.cloudsmith.io/public/biometrid/face01-liveness/maven/" }
        maven { url "https://dl.cloudsmith.io/public/biometrid/auto-capture/maven/" }
        maven { url "https://dl.cloudsmith.io/public/biometrid/nfc/maven/" }
        maven { url "https://raw.githubusercontent.com/iProov/android/master/maven/" }
    }
}

Initialization

This section contains the necessary methods to init Biometrid Standard.

In order to use any of the SDK functionalities, the application needs to initialize it first, using the credentials provided during the enrollment on our platform (see prerequisites section above).

BiometridStandard.getInstance().initialize(
                BIOMETRID_API_SERVER_URL,
                BIOMETRID_APP,
                BIOMETRID_CREDENTIAL,
                Language.English,
                customHeaders,
                this);

Parameter

Description

String BIOMETRID_APP

Application key provided

String BIOMETRID_CREDENTIAL

Credential provided

String BIOMETRID_SERVER_URL

URL credential provided

Language language

Language enum

HashMap<String, String> HashMap

Custom Headers

InitializationCallback callback

Result callback

The method above requires the callback to be linked with an activity to obtain the application Context, however this method is not required. When implementing the InitializationCallback outside of an activity, prefer using the following method:

BiometridStandard.getInstance().initialize(
                BIOMETRID_API_SERVER_URL,
                BIOMETRID_APP,
                BIOMETRID_CREDENTIAL,
                Language.English,
                customHeaders,
                this,
                context);

Parameter

Description

String BIOMETRID_APP

Application key provided

String BIOMETRID_CREDENTIAL

Credential provided

String BIOMETRID_SERVER_URL

URL credential provided

Language language

Language enum

HashMap<String, String> HashMap

Custom Headers

InitializationCallback callback

Result callback

Context context

Context of your app

Implementation example

class ExampleActivity extends AppCompatActivity implements InitializationCallback{
    String TAG = getClass().getSimpleName();
    String BIOMETRID_API_SERVER_URL = "your server URL";
    String BIOMETRID_APP = "your app";
    String BIOMETRID_CREDENTIAL = "your credential";
    
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        try{
            BiometridStandard.getInstance().initialize(
                BIOMETRID_API_SERVER_URL ,
                BIOMETRID_APP,
                BIOMETRID_ONBIOMETRID_CREDENTIAL,
                Language.English,    
                this);
        } catch (UnableToConnectException e) {
            e.printStackTrace();
        }
    }
    
      @Override
    public void initializationCallback(boolean status, @Nullable Errors error) {
        Log.d(TAG, "initializationCallback-> status: " + status);

        if(error != null)
            Log.e(TAG, "initializationCallback-> error: " + error.name());
    }
}

Callback params

Parameter

Description

Boolean status

Receive status on initialization

Errors error

Errors associated enum

Requirements

Basic requirements for a project to use our SDK

Install the following:

  • Android Studio 2024.2.1 or later

  • Targets API Level 26 (Oreo) or later

  • Uses Gradle 8.5 or Later

  • Java Version 17

Make sure that your project meets these requirements:

  • Your project must target Android Oreo 8.0 or later

  • Camera Permissions

  • NFC Permissions

  • Read/Write External Storage

  • Internet

<manifest ... >
   <uses-permission android:name="android.permission.CAMERA"/>
   <uses-permission android:name="android.permission.INTERNET"/>
   <uses-permission android:name="android.permission.NFC" />
   <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
   <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
  ...
</manifest>

Installation

Here are the articles in this section:

Process Management

Here are the articles in this section:

Update Step Management

Here are the articles in this section:

Create Process

This section contains the necessary method to get all the process data

Process creation

Implementation example

Callback params

Update Step

This section contains the necessary method to update step (form types)

For every action in a flow, the corresponding step needs to be updated with the mandatory data specified by the api. Bellow you can find a basic example of an update action form.

Implementation example

Callback params

Get Step State

This section contains the necessary methods to get selected step state.

You have 4 options to get step state:

  • CurrentStep

  • CompletedSteps

Implementation example

Liveness Validation

Perform a liveness detection section and associate it with a process.

Implementation example

Previous Step

This section contains the necessary method to go to previous step

In order to get back to the previous step, the user needs to call this method.

Implementation example

Callback params

Gradle
Create Process
Previous Step
Get Step State
BiometridStandard.getInstance().createProcess(ProcessCallback);

Parameter

Description

ProcessCallback callback

callback

class ExampleActivity extends AppCompatActivity implements InitializationCallback{
    String TAG = getClass().getSimpleName();
    String BIOMETRID_API_SERVER_URL = "your server URL";
    String BIOMETRID_APP = "your app";
    String BIOMETRID_CREDENTIAL = "your credential";
    
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        HashMap<String, String> headers = new HashMap<>();
        headers.put("HeaderName", "headerValue");
        
        BiometridStandard.getInstance().init(
                BIOMETRID_API_SERVER_URL ,
                BIOMETRID_APP,
                BIOMETRID_ONBIOMETRID_CREDENTIAL,
                Language.English,    
                this);
    }
    
    @Override
    public void initializationCallback(boolean status, @Nullable Errors errors) {
        if(status) createProcess();
    }
    
     public void createProcess() {
        BiometridStandard.getInstance().createProcess(new ProcessCallback() {
            @Override
            public void getProcessCallback(boolean status, @Nullable String processId, @Nullable Errors errors) {
                Log.d(TAG, "createProcessCallback-> status: " + status + " process: " + processId);

                if(errors != null)
                    Log.e(TAG, "createProcessCallback-> error: " + errors.name());
            }
        });
    } 
}

Parameter

Description

boolean status

Method request status

String processId

Unique process identifier

Errors error

Errors associated enum

 BiometridStandard.getInstance().updateStep(processToken, data, callback);

Parameter

Description

String processToken

Process token

Map<String, Object> data

Form data (key and values)

ProcessCallback callback

callback

class ExampleActivity extends AppCompatActivity implements InitializationCallback{
    String TAG = getClass().getSimpleName();
    String BIOMETRID_API_SERVER_URL = "your server URL";
    String BIOMETRID_APP = "your app";
    String BIOMETRID_CREDENTIAL = "your credential";
    
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        HashMap<String, String> headers = new HashMap<>();
        headers.put("HeaderName", "headerValue");
        
        BiometridStandard.getInstance().init(
                BIOMETRID_API_SERVER_URL ,
                BIOMETRID_APP,
                BIOMETRID_ONBIOMETRID_CREDENTIAL,
                Language.English,    
                this);
    }
    
    @Override
    public void initializationCallback(boolean status, @Nullable Errors errors) {
        if(status) updateStep();
    }

    public void updateStep() {
        BiometridStandard.getInstance().updateStep(processToken, mockUpdateForm(), new ProcessCallback() {
            @Override
            public void updateStepCallback(boolean status, @Nullable String response, @Nullable Errors errors) {
                Log.d(TAG, "updateStepCallback -> status: " + status + " response: " + response);

                if (errors != null) {
                    Log.e(TAG, " updateStepCallback-> error: " + errors.name());
                }
            }
        });
    }

    public static Map<String, Object> mockUpdateForm() {
        Map<String, Object> data= new HashMap<>();
        
        data.put("account_type", "123456");
        data.put("account_holder", "1");
        data.put("client_account_purpose", "P01");
        data.put("funds_origin", foundsList);
  
        return data;
    }
}

Parameter

Description

boolean status

Method request status

JsonObject response

All the response from the api

Errors error

Errors associated enum

BiometridStandard.getInstance().getStepState(processToken, StepState.CurrentStep, processCallback);

BiometridStandard.getInstance().getStepState(processToken, StepState.CompletedSteps, processCallback);

Parameter

Description

String processToken

Process token

StepState state

StepState enum

ProcessCallback callback

callback

Current Step
public void getCurrentStep() {
 BiometridStandard.getInstance().getStepState(processToken, StepState.CurrentStep, new ProcessCallback() {
    @Override
    public void getStepStateCallback(boolean status, @Nullable String response, @Nullable Errors errors) {
        Log.d(TAG, "getStepStateCallback-> status: "  + status + " response: " + response);

        if(errors != null)
            Log.e(TAG, "getStepStateCallback-> error: " + errors.name());
    }
  });
}
public void getCompletedSteps() {
   BiometridStandard.getInstance().getStepState(processToken, StepState.CompletedSteps, new ProcessCallback() {
    @Override
    public void getStepStateCallback(boolean status, @Nullable String response, @Nullable Errors errors) {
        Log.d(TAG, "getStepStateCallback-> status: " + status + " response: " + response);

        if(errors != null)
            Log.e(TAG, "getStepStateCallback-> error: " + errors.name());
    }
  });
}
 BiometridStandard.getInstance()
         .relateProcess(processToken)
         .startLivenessValidation(data, customization, activity);

String processToken

Process token

Map<String?, String?> data

Required parameters

WrapperCustomization? customization

Liveness SDK customization

AppCompactActivity? activity

Main activity

class ExampleActivity extends AppCompatActivity implements InitializationCallback {
    String TAG = getClass().getSimpleName();
    String BIOMETRID_API_SERVER_URL = "your server URL";
    String BIOMETRID_APP = "your app";
    String BIOMETRID_CREDENTIAL = "your credential";
    
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        HashMap<String, String> headers = new HashMap<>();
        headers.put("HeaderName", "headerValue");
        
        BiometridStandard.getInstance().initialize(
                BIOMETRID_API_SERVER_URL ,
                BIOMETRID_APP,
                BIOMETRID_CREDENTIAL,
                Language.English,    
                this);
    }
    
    @Override
    public void initializationCallback(boolean status, @Nullable Errors errors) {
        if(status) startLivenessValidation();
    }

    public void startLivenessValidation() {
        BiometridStandard.getInstance()
                        .relateProcessId(mProcessToken)
                        .startLivenessDetection(headers, new WrapperCustomization(), this);
    }
    
    private static LivenessResponse livenessResponse = null;
    
    @Override
    protected void onResume() {
        super.onResume();
        livenessResponse = WrapperLiveness.getInstance().getLivenessResponse();
        if(livenessResponse != null) {
            runOnUiThread(() -> {
                try {
                    BiometridStandard.getInstance().getStepState(mProcessToken, StepState.CurrentStep, processCallback);
                } catch (UnableToConnectException | NotInitializedException e) {
                    e.printStackTrace();
                }
            });
        }
    }

    private final ProcessCallback processCallback = new ProcessCallback(){ ... }
}
BiometridStandard.getInstance().previousStep(processToken, processCallback)

Parameter

Description

String processToken

Process token

ProcessCallback callback

callback

class ExampleActivity extends AppCompatActivity implements InitializationCallback{
    String TAG = getClass().getSimpleName();
    String BIOMETRID_API_SERVER_URL = "your server URL";
    String BIOMETRID_APP = "your app";
    String BIOMETRID_CREDENTIAL = "your credential";
    
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        HashMap<String, String> headers = new HashMap<>();
        headers.put("HeaderName", "headerValue");
        
        BiometridStandard.getInstance().init(
                BIOMETRID_API_SERVER_URL ,
                BIOMETRID_APP,
                BIOMETRID_ONBIOMETRID_CREDENTIAL,
                Language.English,    
                this);
    }
    
    @Override
    public void initializationCallback(boolean status, @Nullable Errors errors) {
        if(status) previousStep();
    }
    
    public void previousStep() {
        BiometridOn.getInstance().previousStep(processToken, new ProcessCallback() {
            @Override
            public void previousStepCallback(boolean status, @Nullable String response, @Nullable Errors errors) {
                Log.d(TAG, "previousStepCallback -> status: " + status + " response: " + response);

                if(errors != null)
                    Log.e(TAG, "previousStepCallback -> error: " + errors.name());
            }
        });
    }
}

Parameter

Description

Boolean status

Method request status

JsonObject response

All the response data from the api

Errors error

Errors associated enum

Configurations

This section describes the available auto capture configurations.

The document capture and MRZ reader features are customizable and allow configuring the shown texts, colors, buttons, timers and object detection parameters.

The configurations can be defined as exemplified below:

val style = CaptureStyleOptions(
    textColor = R.color.black,
    textBackground = R.color.white,
    overlayColor = R.color.black,
    overlaySuccessColor = R.color.white,
)
val texts = CaptureTextOptions(title = "Insert a card", text = "inside the frame")
val photoOptions = ManualPhotoOptions(active = false)
val options = CaptureOptions(takePhoto = photoOptions, i18n = texts, style = style)

For more information about each possible configuration see the corresponding data model below:

Models

CaptureOptions
Description

CaptureType type

Determines the type of objects the camera is allowed to detect. (ID Card, Passport or Face)

Float? threshold

Adjusts the minimum score limit for the detected objects to be considered optimal within a range of [0.0, 1.0].

Defaults to 0.75.

Int? margin

Adds a margin of pixels around the captured image.

Boolean? cameraChange

Determines the visibility of the button to switch between the available camera.

Defaults to true.

Boolean? enablePortrait

When enabled, allows the camera to be used in portrait mode.

Defaults to false.

Int? timerCapture

The time in seconds until a photo is captured from the moment an object is detected.

Defaults to 2 seconds.

ManualPhotoOptions? takePhoto

Defines the configurations of the button to manually capture a photo.

CaptureTextOptions? i18n

Defines the texts used for the camera preview.

CaptureStyleOptions? style

Defines the colors for the camera preview.


ManualPhotoOptions
Description

Boolean? active

Determines the visibility of the button to manually capture a photo.

Defaults to true.

Int? timer

The time in seconds until the button to manually capture a photo is visible, from the moment the camera was started.

Defaults to 30 seconds.


CaptureTextOptions
Description

String? outOfFocus

Defines the text shown when the image is out of focus.

String? frameCard

Defines the text shown when no cards are inside the frame.

String? holdStill

Defines the text immediately after a document is detected inside the frame.

String? success

Defines the text shown when the capture is terminated with success.

String? error

Defines the text shown when the camera encounters an error.


CaptureStyleOptions
Description

@ColorRes Int? textColor

Defines the color of the text shown.

@ColorRes Int? textBackground

Defines the color of the background shown behind the text.

@ColorRes Int? overlayColor

Defines the color for the camera overlay stroke.

@ColorRes Int? overlaySuccessColor

Defines the color for the camera overlay stroke shown when the capture is completed.


CaptureType - enum
Description

IdCard

Indicates the detector only considers objects of type "card".

Passport

Indicates the detector only considers objects of type "passport".

Face

Indicates the detector only considers objects of type "face".

Configurations

This section describes the available camera configurations.

The camera feature is customizable and allows configuring the activity texts and colors.

The configurations can be defined as exemplified below:

val style = CameraStyles(
    focusTextColor = R.color.black,
    focusBackgroundColor = R.color.white,
    infoButtonColor = R.color.black,
)
val texts = CameraTexts(outOfFocus = "Out of focus", infoMessage = "More info. here")
val options = CameraOptions(i18n = texts, style = style)

For more information about each possible configuration see the corresponding data model below:

Models

CameraOptions
Description

CameraTexts? i18n

Defines the texts used for the camera preview.

CameraStyles? style

Defines the styles of the camera preview.

Int fileMaxMegabytes

Maximum file size of the captured photo.

Defaults to 10.


CameraStyles
Description

@ColorRes Int? focusTextColor

Defines the color of the text shown when the image is out of focus.

@ColorRes Int? focusBackgroundColor

Defines the color of the background shown behind the text, when the image is out of focus.

@ColorRes Int? infoButtonColor

Defines color of the more information button.


CameraTexts
Description

String? outOfFocus

Defines the text shown when the image is out of focus.

String? infoMessage

Defines the text shown inside the more information dialog.

String? infoButton

Defines the text of the close button inside the more information dialog.

Auto Capture

Automatically capture identification document, MRZ code's and face.

// Start automatic capture (Document or Face)
BiometridStandard.getInstance().startAutoCapture(processCallback, options);
// Start mrz code scanner
BiometridStandard.getInstance().startMRZCapture(processCallback, options);

ProcessCallback processCallback

Callback where result information is received.

CaptureOptions? options

AutoCaptureSDK configurations

Implementation Example

class ExampleActivity extends AppCompatActivity implements InitializationCallback{
    String TAG = getClass().getSimpleName();
    String BIOMETRID_API_SERVER_URL = "your server URL";
    String BIOMETRID_APP = "your app";
    String BIOMETRID_CREDENTIAL = "your credential";
    
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        BiometridStandard.getInstance().init(
                BIOMETRID_API_SERVER_URL ,
                BIOMETRID_APP,
                BIOMETRID_ONBIOMETRID_CREDENTIAL,
                Language.English,    
                this);
    }
    
    @Override
    public void initializationCallback(boolean status, @Nullable Errors errors) {
        if(status) startAutoCapture();
    }
    
    public void startAutoCapture() {
        BiometridStandard.getInstance().startAutoCapture(processCallback, new CaptureOptions());
    }
    
     public void startFaceCapture() {
        BiometridStandard.getInstance().startAutoCapture(processCallback, new CaptureOptions(type = CaptureType.Face));
    }
    
    public void startMRZReader() {
        BiometridStandard.getInstance().startMRZCapture(processCallback, new CaptureOptions());
    }
    
    private ProcessCallback processCallback = new ProcessCallback() {
        @Override
        public void documentCaptureCallback(@Nullable String image64, mrz: MrzData?, @Nullable Errors errors) {
            if (errors != null) {
                Log.e(TAG, "documentCapture -> error: " + errors.getMessage());
            } else {
                if(mrz != null)  Log.d(TAG, "mrzCapture -> MRZData: " + mrz.toString());
                else Log.d(TAG, "documentCapture -> base64 image: " + image64);
            }
    };
}

Callback params

Parameter

Description

String? image64

Captured document photo encoded in Base64

MrzData? mrz

Captured information from MRZ Code

Errors? errors

Detected errors

Scan result

This section describes the scanned information from the passport, when available.

NFCData
Description

String? documentType

Type of the scanned document

String? origin

Scanned origin information.

String? name

Scanned name information.

String? surname

Scanned surname information.

String? mrzCode

Security document MRZ code.

String? nationality

Scanned nationality information.

String? documentNumber

Scanned document number information.

String? dateOfBirth

Scanned birth date information.

String? gender

Scanned gender information.

String? dateOfExpiry

Scanned expiry date information.

String? idNumber

Scanned identification number information.

FaceFeaturesResult? faceFeatures

Scanned face features information.

PhotosResult? photos

Scanned photos information.

AdditionalDetailsResult? additionalFields

Scanned additional details information.

DocumentDetailsResult? additionalFields

Scanned document details information.

List<String>? securityInfo

Scanned document security information.

String? publicKey

Scanned document public key information.

EmergencyContactsResult? emergencyContacts

Scanned emergency contacts information.


FaceFeaturesResult
Description

String? eyeColor

Scanned eye color.

String? hairColor

Scanned hair color.

String? expression

Scanned face expression.

List<String>? features

Scanned facial features.


PhotosResult
Description

String? portrait

Scanned face photo encoded in Base64.

String? fingerprint

Scanned fingerprints image in Base64.

String? iris

Scanned iris photo encoded in Base64.

String? signature

Scanned signature photo encoded in Base64.

String? additionalPortrait

Scanned additional portrait photo encoded in Base64.

String? additionalBiometric

Scanned additional biometric photo encoded in Base64.


AdditionalDetailsResult
Description

List<String>? otherNames

Scanned additional other names.

List<String>? otherTravelDocumentNumbers

Scanned additional other travel document numbers.

List<String>? placeOfBirth

Scanned place of birth.

List<String>? permanentAddress

Scanned address information.

String? nameOfOwner

Scanned document owner name.

String? personalNumber

Scanned personal number.

String? telephone

Scanned telephone.

String? profession

Scanned profession.

String? title

Scanned title.

String? personalSummary

Scanned personal summary.

String? custodyInformation

Scanned custody information.


DocumentDetailsResult
Description

String? issuingAuthority

Scanned document issuing authority.

String? dateOfIssue

Scanned document date of issue.

String? endorsementsAndObservations

Scanned endorsements and observations.

String? taxOrExitRequirements

Scanned tax or exit requirements.

String? dateAndTimeOfPersonalization

Scanned date and time of personalization.

String? personalizationSystemSerialNumber

Scanned personalization system serial number.

List<String>? otherPersonNames

Scanned other person names.


EmergencyContactsResult
Description

String? name

Scanned emergency contact name.

String? phone

Scanned emergency contact phone.

String? address

Scanned emergency contact address.


MRZData
Description

String documentNumber

Scanned document number from MRZ

String dateOfBirth

Scanned birth date from MRZ

String dateOfExpiry

Scanned expiry date from MRZ

Photo Capture

Perform the capture of a photo and encode in base64. Prevents capturing blurred images.

BiometridStandard.getInstance().startCamera(processCallback, options);

ProcessCallback processCallback

Callback where result information is received.

CameraOptions? options

Camera configurations

Implementation Example

class ExampleActivity extends AppCompatActivity implements InitializationCallback{
    String TAG = getClass().getSimpleName();
    String BIOMETRID_API_SERVER_URL = "your server URL";
    String BIOMETRID_APP = "your app";
    String BIOMETRID_CREDENTIAL = "your credential";
    
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        BiometridStandard.getInstance().init(
                BIOMETRID_API_SERVER_URL ,
                BIOMETRID_APP,
                BIOMETRID_ONBIOMETRID_CREDENTIAL,
                Language.English,    
                this);
    }
    
    @Override
    public void initializationCallback(boolean status, @Nullable Errors errors) {
        if(status) startCamera();
    }
    
    public void startCamera() {
        BiometridStandard.getInstance().startCamera(new ProcessCallback() {
            @Override
            public void cameraCallback(@Nullable String image64, @Nullable Errors errors) {
                if (errors != null) {
                    Log.e(TAG, "cameraCallback -> error: " + errors.getMessage());
                } else {
                    Log.d(TAG, "cameraCallback -> base64 image: " + image64);
                }
        }, new CameraOptions());
    }
}

Callback params

Parameter

Description

String? image64

Captured document photo encoded in Base64

Errors? errors

Detected errors

NFC Passport Reader

Scan passport and retrieve information using NFC technologies.

BiometridStandard.getInstance().startNfc(processCallback, nfcCustomization, scannerCustomization);a

ProcessCallback processCallback

Callback where result information is received.

NFCustomization? nfcCustomization

NFC activity text and color configurations

CaptureOptions? scannerCustomization

MRZ Code reader configurations

The standard method for reading passport information involves an MRZ code reader. This step is essential for securely connecting to the passport via NFC.

In case the MRZ data required was already obtained, the MRZ reading step mentioned above can be skipped when using the following method:

BiometridStandard.getInstance().startNfc(processCallback, documentMrz, scannerCustomization);a

ProcessCallback processCallback

Callback where result information is received.

MrzData documentMrz

Required document data to allow NFC scan.

NFCustomization? nfcCustomization

NFC activity text and color configurations

Implementation Example

class ExampleActivity extends AppCompatActivity implements InitializationCallback{
    String TAG = getClass().getSimpleName();
    String BIOMETRID_API_SERVER_URL = "your server URL";
    String BIOMETRID_APP = "your app";
    String BIOMETRID_CREDENTIAL = "your credential";
    
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        BiometridStandard.getInstance().init(
                BIOMETRID_API_SERVER_URL ,
                BIOMETRID_APP,
                BIOMETRID_ONBIOMETRID_CREDENTIAL,
                Language.English,    
                this);
    }
    
    @Override
    public void initializationCallback(boolean status, @Nullable Errors errors) {
        if(status) startNfc();
    }
    
    public void startNfc() {
        BiometridStandard.getInstance().startNfc(
            processCallback,
            new NFCustomization(),
            new CaptureOptions()
        );
    } 
    
    public void startNfcWithoutMRZReader() {
        BiometridStandard.getInstance().startNfc(
            processCallback,
            new MrzData("document_number","birth_date","expiry_date"),
            new NFCustomization()
        );
    } 
    
    private ProcessCallback processCalback = new ProcessCallback() {
        @Override
        public void nfcCallback(@Nullable NFCData document, @Nullable Errors errors) {
            if (errors != null) {
                Log.e(TAG, "nfcCallback -> error: " + errors.getMessage());
            } else {
                Log.d(TAG, "nfcCallback -> passport information: " + document.toString());
            }
    };
}

Callback params

Parameter

Description

EDocument? document

Contains the complete scanned passport information

Errors? errors

Contains detected errors

Initialization

This section contains the necessary methods to init Biometrid Standard.

In order to use any of the SDK functionalities, the application needs to initialize it first, using the credentials provided during the enrollment on our platform (see prerequisites section above).

BiometridFull.INSTANCE.initialize(
                BIOMETRID_API_SERVER_URL,
                BIOMETRID_APP,
                BIOMETRID_CREDENTIAL,
                BIOMETRID_APP_URL,
                customHeaders,
                this);

Parameter

Description

String BIOMETRID_APP

Application key provided

String BIOMETRID_CREDENTIAL

Credential provided

String BIOMETRID_SERVER_URL

URL credential provided

String BIOMETRID_APP_URL

App URL provided

HashMap<String, String> HashMap

Custom Headers

InitializationCallback callback

Result callback

The method above requires the callback to be linked with an activity to obtain the application Context, however this method is not required. When implementing the InitializationCallback outside of an activity, prefer using the following method:

BiometridFull.INSTANCE.initialize(
                BIOMETRID_API_SERVER_URL,
                BIOMETRID_APP,
                BIOMETRID_CREDENTIAL,
                BIOMETRID_APP_URL,
                customHeaders,
                this,
                context);

Parameter

Description

String BIOMETRID_APP

Application key provided

String BIOMETRID_CREDENTIAL

Credential provided

String BIOMETRID_SERVER_URL

URL credential provided

String BIOMETRID_APP_URL

App URL provided

HashMap<String, String> HashMap

Custom Headers

InitializationCallback callback

Result callback

Context context

Context of your app

Implementation example

class ExampleActivity extends AppCompatActivity implements InitializationCallback, InterfaceCallback {
    String TAG = getClass().getSimpleName();
    String BIOMETRID_API_SERVER_URL = "your server URL";
    String BIOMETRID_APP = "your app";
    String BIOMETRID_CREDENTIAL = "your credential";
    String BIOMETRID_APP_URL = "app URL";
    
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        try{
            BiometridFull.INSTANCE.initialize(
                BIOMETRID_API_SERVER_URL ,
                BIOMETRID_APP,
                BIOMETRID_CREDENTIAL,
                BIOMETRID_APP_URL,
                new HashMap<>(),    
                this);
        } catch (UnableToConnectException e) {
            e.printStackTrace();
        }
    }
    
    @Override
    public void initializationCallback(boolean status, @Nullable Errors error) {
        Log.d(TAG, "initializationCallback-> status: " + status);
        if(error != null) Log.e(TAG, "initializationCallback-> error: " + error.name());
    }
    
    @Override
    public void processCreated(String processId) {
        Log.d(TAG, "Process created -> id: " + processId);
    }

    @Override
    public void processFinished() {
        Log.d(TAG, "Process finished");
    }

    @Override
    public void interfaceStarted() {
        Log.d(TAG, "Interface started");
    }

    @Override
    public void interfaceClosed() {
        Log.d(TAG, "Interface closed");
    }
}

Callback params

Parameter

Description

Boolean status

Receive status on initialization

Errors error

Errors associated enum

Biometric Authentication

Perform biometric authentication using the device preferred authentication methods: FaceID, Fingerprint or PIN code.

 BiometridStandard.getInstance()
         .startAuthentication(activity, processCallback);

AppCompactActivity? activity

Main activity.

ProcessCallback callback

The process result callback.

Implementation example

class ExampleActivity extends AppCompatActivity implements InitializationCallback {
    String TAG = getClass().getSimpleName();
    String BIOMETRID_API_SERVER_URL = "your server URL";
    String BIOMETRID_APP = "your app";
    String BIOMETRID_CREDENTIAL = "your credential";
    
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        BiometridStandard.getInstance().initialize(
                BIOMETRID_API_SERVER_URL ,
                BIOMETRID_APP,
                BIOMETRID_CREDENTIAL,
                Language.English,    
                this);
    }
    
    @Override
    public void initializationCallback(boolean status, @Nullable Errors errors) {
        if(status) startAuthentication();
    }

    public void startAuthentication() {
        BiometridStandard.getInstance().startCamera(this, new ProcessCallback() {
            @Override
            public void authenticationCallback(@Nullable Boolean status, @Nullable Errors errors) {
                if (errors != null) {
                    Log.e(TAG, "authenticationCallback -> error: " + errors.getMessage());
                } else {
                    Log.d(TAG, "authenticationCallback -> status: " + status);
                }
        });
    }
}

authenticationCallback

Description

Boolean? status

The authentication status.

Errors? errors

Detected errors.

Device Location

Obtain the device location using a combination of WIFI, GPS, and cell phone towers signals.

BiometridStandard.getInstance().getLocation(processCallback);

ProcessCallback callback

The process result callback.

Implementation example

class ExampleActivity extends AppCompatActivity implements InitializationCallback {
    String TAG = getClass().getSimpleName();
    String BIOMETRID_API_SERVER_URL = "your server URL";
    String BIOMETRID_APP = "your app";
    String BIOMETRID_CREDENTIAL = "your credential";
    
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        BiometridStandard.getInstance().initialize(
                BIOMETRID_API_SERVER_URL ,
                BIOMETRID_APP,
                BIOMETRID_CREDENTIAL,
                Language.English,    
                this);
    }
    
    @Override
    public void initializationCallback(boolean status, @Nullable Errors errors) {
        if(status) getLocation();
    }

    public void getLocation() {
        BiometridStandard.getInstance().getLocation(new ProcessCallback() {
            @Override
            public void locationCallback(@Nullable LocationData location, @Nullable Errors errors) {
                if (errors != null) {
                    Log.e(TAG, "locationCallback -> error: " + errors.getMessage());
                } else {
                    Log.d(TAG, "locationCallback -> location: " + location.toString());
                }
        });
    }
}

locationCallback

Description

LocationData? location

The device location coordinates.

Errors? errors

Detected errors.


LocationData

Description

String? altitude

The altitude coordinates.

String? longitude

The longitude coordinates.

String? latitude

The latitude coordinates.

Update Step

Photo Capture

This section describes the photo capture process.

In order to improve the user experience and performance of the WebView, every time it is required to use the camera functionality, the Full SDK will exit from the WebView and open a native camera activity which then returns the results back to the WebView, resuming the created process flow.

There are various camera modes that can be used and configured through the backend, described below:

  • Back camera (Default camera mode)

  • Frontal camera (For scenarios where a face photo is required)

  • Document Capture camera (For scenarios where identification documents are required)

    • Automatically detects and captures documents.

    • Prevents capture when subject is out of focus.

    • Allows usage of the front and back cameras.

    • Allows manual photo capture.

Liveness Validation

This section describes the liveness detection process.

In order to improve the user experience and performance of the WebView, every time the user is required to perform a liveness validation process, the Full SDK will exit from the WebView and start a native FaceTec activity, with instructions to improve the user validation success rate. When the process is completed the result is automatically returned to the WebView, resuming the created process flow.

The layout text and colors of the liveness validation process can be setup through the backend.

Installation

Here are the articles in this section:

Configurations

This section describes the available NFC configurations.

The NFC feature is customizable and allows configuring the activity texts and colors.

The configurations can be defined as exemplified below:

// NFC configurations
val nfcTexts = NFC()
nfcTexts.nfcTitle = "Ready to Scan"
nfcTexts.nfcDescription = "Hold the passport close to the phone"

val ctaTexts = CTA()
ctaTexts.settings = "Settings"
ctaTexts.skip = "Skip"

val translations = Translations()
translations.nfc = nfcTexts
translations.cta = ctaTexts

val colors = Colors()
colors.primary = "#4880FF"
colors.secondary = "#F2F6FF"

val nfcCustomization = NFCustomization()
nfcCustomization.translations = translations
nfcCustomization.colors = colors

// Scanner configurations
val style = CaptureStyleOptions(
    textColor = R.color.black,
    textBackground = R.color.white,
    overlayColor = R.color.black,
    overlaySuccessColor = R.color.white,
)
val texts = CaptureTextOptions(title = "Insert a card", text = "inside the frame")
val photoOptions = ManualPhotoOptions(active = false)
val scannerCustomization = CaptureOptions(takePhoto = photoOptions, i18n = texts, style = style)

For more information about each possible configuration see the corresponding data model below:

Models

NFCustomization
Description

Translations translations

Defines the texts used for the NFC activity.

Colors colors

Defines the colors used in the activity.


Translations
Description

CTA cta

Defines the texts for the main action buttons.

NFC nfc

Defines the texts shown during the NFC scanning process.


CTA
Description

String proceed

Defines the proceed action button text.

String skip

Defines the skip action button text.

String settings

Defines the settings action button text.

String cancel

Defines the cancel action button text.

String allow

Defines the allow action button text.


NFC
Description

String instructionsTitle

Defines the NFC instructions title text.

String instructionsSlide1Description

Defines the NFC instructions first slide text.

String instructionsSlide2Description

Defines the NFC instructions second slide text.

String instructionsSlide3Description

Defines the NFC instructions third slide text.

String instructionsSlide4Description

Defines the NFC instructions fourth slide text.

String nfcTitle

Defines the NFC scan title text.

String nfcDescription

Defines the NFC scan description text.

String nfcHold

Defines the NFC scan hold still text.

String nfcCompleted

Defines the NFC scan completed text.

String errorTitle

Defines the error title text.

String errorDescription

Defines the error description text.

String success

Defines the success text.

String close

Defines the close action text.

String permissionTitle

Defines the permission title text.

String permissionDescription

Defines the permission description text.


Colors
Description

String primary

Defines the hex value for the primary color of the activity.

String secondary

Defines the hex value for the secondary color of the activity.

String error

Defines the hex value for the error color of the activity.

String base

Defines the hex value for the base color of the activity.


For detailed scanner configurations, please visit the following page:

Gradle

Biometrid Standard supports Gradle for dependency management.

Added Build.gradle(module: app)

Requirements

Basic requirements for a project to use our SDK

Install the following:

  • Android Studio 2024.2.1 or later

  • Targets API Level 26 (Oreo) or later

  • Uses Gradle 8.5 or Later

  • Java Version 17

Make sure that your project meets these requirements:

  • Your project must target Android Oreo 8.0 or later

  • Camera Permissions

  • NFC Permissions

  • Read/Write External Storage

  • Notification Permission for Android Tiramisu 13.0 or later

  • Internet

Start

This section contains the necessary methods to start a process in BiometridFull.

The general idea behind BiometridFull is to implement Biometrid with UI. After initialize the SDK, it is possible to use the method below to start the WebView UI screens that implement the app id used during initialization.

Use the InterfaceCallback to observe if the SDK was started correctly (see more about in callbacks section).

Presence Detection

Performs a real time user presence detection by scanning the user face features.

Implementation example

Gradle
Configurations
implementation 'com.biometrid:full-android-sdk:3.0.0'
allprojects {
    repositories {
        google()
        mavenCentral()
        maven { url "https://dl.cloudsmith.io/public/biometrid/biometrid/maven/" }
        maven { url "https://dl.cloudsmith.io/public/biometrid/face01-liveness/maven/" }
        maven { url "https://dl.cloudsmith.io/public/biometrid/auto-capture/maven/" }
        maven { url "https://dl.cloudsmith.io/public/biometrid/nfc/maven/" }
    }
}
<manifest ... >
   <uses-permission android:name="android.permission.CAMERA"/>
   <uses-permission android:name="android.permission.INTERNET"/>
   <uses-permission android:name="android.permission.NFC" />
   <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
   <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
   <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
  ...
</manifest>
BiometridFull.INSTANCE.start(processId, interfaceCallback)
BiometridStandard.getInstance().startPresenceDetection(activity, processCallback);

AppCompatActivity activity

The current activity.

ProcessCallback callback

The process result callback.

class ExampleActivity extends AppCompatActivity implements InitializationCallback {
    String TAG = getClass().getSimpleName();
    String BIOMETRID_API_SERVER_URL = "your server URL";
    String BIOMETRID_APP = "your app";
    String BIOMETRID_CREDENTIAL = "your credential";
    
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        BiometridStandard.getInstance().initialize(
                BIOMETRID_API_SERVER_URL ,
                BIOMETRID_APP,
                BIOMETRID_CREDENTIAL,
                Language.English,    
                this);
    }
    
    @Override
    public void initializationCallback(boolean status, @Nullable Errors errors) {
        if(status) getLocation();
    }

    public void getLocation() {
        BiometridStandard.getInstance().startPresenceDetection(this, new ProcessCallback() {
            @Override
            public void genuinePresenceCallback(@Nullable Boolean status, @Nullable Boolean processing, @Nullable Errors errors) {
                if (errors != null) {
                    Log.e(TAG, "genuinePresenceCallback -> error: " + errors.getMessage());
                } else {
                    Log.d(TAG, "genuinePresenceCallback -> status: " + status);
                }
        });
    }
}

locationCallback

Description

Boolean? status

The result status.

Boolean? processing

Wether the current process is uploading the detected face features.

Errors? errors

Detected errors.

Callbacks

This section contains the necessary methods to implement the InterfaceCallback

Called by initialize method. Use this to observe if SDK was correctly initialized:

public void initializeCallback(boolean status, @Nullable Errors error)

Use this to observe if a process was correctly created :

public void processCreated(String processId)

Use this to observe if a process was correctly closed:

public void processFinished()

Use this to observe when the SDK start:

public void interfaceStarted()

Use this to observe if SDK is closed:

public void interfaceClosed()

Configurations

This section describes the available presence detection configurations.

The presence detector activities are customizable and allow configuring the look and feel of this feature.

The configurations can be defined as exemplified below:

Models

Face06Customization
Description

String title

Determines the activity title.

Int titleTextColor

Determines the title text color.

Defaults to WHITE.

Int headerBackgroundColor

Determines the header background color. Defaults to TRANSPARENT.

LineDrawingFilter filter

Determines the filter applied to the scanner.

Defaults to LineDrawingFilter().

Int surroundColor

Determines the frame color.

Defaults to 0x66000000.

ResourceFont font

Determines the font used.

Icon icon

Determines the icon style.

Boolean enableScreenshots

Determines if screenshots are allowed when scanning the face.

Defaults to false.

CloseButton closeButton

Determines the close button style.

Int promptTextColor

Determines the result prompt text color.

Defaults to WHITE.

Boolean promptRoundedCorners

Determines if the result prompt should show rounded corners or not.

Defaults to true.

Boolean disableExteriorEffects

Determines the exterior frame effects visibility.

Defaults to false.

List<Certificate> certificates

Determines de certificates used to validate the scanned face.

Defaults to null.

Int timeoutSecs

Determines the time the activity will wait before closing if no face is detected.

Defaults to 10.

Orientation orientation

Determines the activity screen orientation.

Defaults to PORTRAIT.