LivenessCustomization is an object required to initialise and alter many visual aspects of Biometrid's liveness detection surface.
Initialisation
Required values :
View Id
Represent the id given by the developer where Biometrid's liveness engine will appear
Liveness token
Token required by the client to enable the liveness engine
Public key
key generated to enable the connection between client and server
Required values (Custom service deployment):
View Id
Represent the id given by the developer where Biometrid's liveness engine will appear
Liveness token
Liveness token
Public key
Package name
Expiry date
Key (contact our support for more details on this matter)
Implementation example
public class ExampleActivity extends Activity implements AuthFaceCallback {
private String filepath_front, filepath_back;
//This variables are here just to provide some feedback on the expected structure and are not valid for the actual procedure
private String public_key = "-----BEGIN PUBLIC KEY------\n" +
"MAAd1o3lksadgakOINYU09KJHNSACD" +
"akOIN9813HJMAJSBC109KJHNSACsad" +
"sadgakOINY13HJMAJSBC109NSAC234" +
"-----END PUBLIC KEY------" +
private String liveness_token = "jkhfdaKJHF89a4s123NGJHKJHS";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_example);
//Object initialisation
LivenessCustomisation customisation = new LivenessCustomisation();
//Only required on some cases
//customisation.setViewId(R.id.liveness_surface);
//A liveness token and public key are mandatory for the engine to properly work
customisation.setLivenessToken(liveness_token);
customisation.setPublicKey(public_key);
//Rrquired only for custom service deployments
customisation.setAppId(getApplicationContext().getPackageName());
customisation.setExpiryDate("Insert expiry date here");
customisation.setLicenseKey("Insert license key here");
//example of UI alterations
customization.setMainBackgroundColor(Color.parseColor("#f49241"));
customization.setBorderColor(Color.parseColor("#000000"));
customization.setBorderWidth(1);
customization.setFontLight("monospace");
customization.setFontMedium("sans-serif");
/*
This object is expected as a parameters on the startLivenessDetectionn method.
For more details check the "Submit selfie with liveness" section of this documentation.
*/
}
@Override
public void livenessDetectionResult(boolean status, String file_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.*/
Log.i("path", path);
}
}
...
}
For more information on this technology please contact us