Biometrid Android SDK
3.0.2
3.0.2
  • Introduction
  • Standard SDK
    • Initialization
    • Requirements
    • Enums
    • Installation
      • Gradle
    • Process Management
      • Create Process
      • Previous Step
      • Get Step State
    • Update Step Management
      • Update Step
    • Liveness Validation
    • Photo Capture
      • Configurations
    • Auto Capture
      • Configurations
    • NFC Passport Reader
      • Scan result
      • Configurations
    • Biometric Authentication
    • Device Location
    • Presence Detection
      • Configurations
  • Full SDK
    • Initialization
    • Requirements
    • Installation
      • Gradle
    • Start
    • Photo Capture
    • Liveness Validation
    • Callbacks
Powered by GitBook
On this page

Was this helpful?

Export as PDF
  1. Standard SDK

Liveness Validation

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

 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

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);
        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(){ ... }
}
PreviousUpdate StepNextPhoto Capture

Was this helpful?