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
  • Initialisation method
  • Callback
  • Implementation example
  1. Voice Engine

Initialization

Before any audio submission, Biometrid's voice engine requires to be initialised. This allows the retrieval of previous sessions and the start of new ones.

Initialisation method

BiometridAuthVoice.getInstance().init(
    String id, //biometrid id 
    Enum SessionType, //ex: SessionType.Verify
    AuthVoiceCallback your_context
);

initVoice()

method

String id

id corresponding the biometric user

SessionType session

session to initialise

AuthVoiceCallback

Applicational context

Callback

@Override
    public void authVoiceInitCallback(boolean status, SessionType session, String prompt, @Nullable JSONObject json, @Nullable Errors errors) {
       if(!status && serrors != null) 
          Log.e("error", error.getMessage());
       else {
          Log.i("current session", session.getName());
          Log.i("active prompt", prompt);
       }
    }

authVoiceInitCallback

callback

boolean status

request status

SessionType session

active session

String prompt

prompt for next submission

JsonObject json

complete response from api

Errors errors

error object

Implementation example

public class ExampleActivity extends Activity 
        implements AuthVoiceCallback {

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

       BiometridAuthVoice.getInstance().init(
           "user_id", 
           SessionType.ENROLL, 
           this
       );
    }

   @Override
    public void authVoiceInitCallback(boolean status, SessionType session, String prompt, @Nullable JSONObject json, @Nullable Errors errors) {
        if(errors =! null){
            //handle erros
            switch(errors){
                case INVALID_CREDENTIALS:
                     Log.e("error", errors.getMessage());
                break;
                ...
            }
        }
        else {
            /*This variable contains the next expected 
            set of numbers for the corresponding session */
            Log.i("prompt", prompt);
        }
    }

    ...
}

PreviousVoice EngineNextAudio Recording

Last updated 6 years ago

For more information on this method please check our api

documentation