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

Audio Recording

BiometridAuthVoice provides a simple way to record and convert the required audio samples.

Method

BiometridAuthVoice.getInstance().recordAudio(
    int timer, 
    AuthVoiceCallback context
);

recordAudio()

method

int timer

time in milliseconds

AuthVoiceCallback

Applicational context

Callback

@Override
public void authRecordAudioCallback(boolean status, String path, 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

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().recordAudio(
           4000,
           this
       );
    }

    @Override
    public void authRecordAudioCallback(boolean status, String path, 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 containg the recorded 
            audio sample */
            Log.i("path", path);
        }
    }    

    ...
}
PreviousInitializationNextRecording Submission

Last updated 6 years ago