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);
}
}
...
}
Last updated