IdValidation(Android)SDK v1.10.10
This library makes it possible to capture two images "INE front" and "INE back" that correspond to the two sides of the voter's credential. Send them to the INE, IDVAL and ONLYOCR services to verify the authenticity of the captured documents and issue the result. This document is specifically aimed at users of technical level who require information about the SDK of Your Identity "IdValidation".
Requirements
Android Studio 3.5. +
Android OS 5.0+
Arquitectura -armv7, arm64
Credentials
ApiKey: previously delivered by Tu identidad.
Technology
IdValidation SDK (Android) was developed in Java.
• Java
• Android Studio 3.5.1
Methods
Azure dependency:
Dependency that is instantiated in the Gradle root to access the Tu Identidad IdValidation repository.
maven {
url 'https://jitpack.io'
}
maven {
url 'https://pkgs.dev.azure.com/tu-identidad/TuIdentidad-Android-SDK/_packaging/INE-SDK/maven/v1'
}
Library implementation
Dependency that is instantiated in the Gradle app that calls the Tu identidad IdValidation library.
{
implementation 'com.tuidentidad.ine:idval:1.10.10'
}
TuID.init method instance
Method instance that calls the SDK.
TuID.init(this, false, false, "Your ApiKey", method.INE,new
TuID.INEValidation(true,true,true,true,true));
TuID.init(this, false, false, "Your ApiKey", method.IDVAL);
Parameters
The TuID.init (Context ctx, Boolean showTutorial, Boolean showResults, method m) method receives 4 parameters:
• Context ctx: refers to the context from where this method is called, example (this, getApplicationContext ())
• Boolean showTutorial: “true” if you want to show how the SDK works and “false” not to show the tutorial.
• Boolean showResults: “true” if you want to show a view with the results of the SDK and “false” to not show the results view.
• Method m: refers to the method to which the request will be made.
• m.INE: method that validates INE (returns validation result).
• TuID.INEValidation: Class instance for validation of (Info, Quality, Patterns, Curp, Face).
• m.IDVAL: method that validates the id (returns the result of the validation and OCR).
• m.ONLYOCR: method that only obtains the OCR (text) of the id without validating it (returns only OCR).
onActivityResult method instance
Method required to get the data from the SDK.
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(requestCode == TuID.AUTHID_ACTIVITY_RESULT){
if(resultCode == RESULT_OK){
Bundle extras = data.getExtras();
assert extras != null;
Boolean status = extras.getBoolean("status");
String response = extras.getString("response");
String error = extras.getString("error");
Uri ineFPath = extras.getParcelable("inefPath");
Uri ineBPath = extras.getParcelable("inebPath");
Bitmap bitmapF = null;
Bitmap bitmapB = null;
//Get images that are use for validation
try {
bitmapF = MediaStore.Images.Media.getBitmap(this.getContentResolver(), ineFPath);
bitmapB = MediaStore.Images.Media.getBitmap(this.getContentResolver(), ineBPath);
ineFrontImageView.setImageBitmap(bitmapF);
ineBackImageView.setImageBitmap(bitmapB);
}catch (IOException e) {
e.printStackTrace();
}
//Check validation status
if (status == false) {
Toast.makeText(getApplicationContext(), error.toString(), Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getApplicationContext(), response, Toast.LENGTH_SHORT).show();
}
}
}
}