IdValidation(Android) SDK v1.10.14
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 service 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
SDKs document preferences
Format
Type | Format | Size | Weight |
---|---|---|---|
Document front image and back image | .JPEG, .PNG, .JPG for attached files. | About 800px x 1000px | 4MB as maximum. |
Required characteristics for images (front and back).
Characteristic | Description |
---|---|
Focused | The images must be focused and show readable information for the correct execution of the OCR process. |
Brightness | The images must not show glare of light, excess brightness or contrast alterations that cause error in the validation of authenticity. |
Quality | The documents must have legibility characteristics, not be altered, not present physical damage or alterations that prevent the reading of the information and execution of the validations. |
Figure | The image should preferably be in the shape of a rectangle, where only the credential is shown without excessive background. Likewise, for both sides of the document. |
Accepted types | The credential have to be types C, D, E, F, G or H. |
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.14'
}
TuID.init method instance
Method instance that calls the SDK.
TuID.init(
this,
false,
false,
"Your ApiKey",
method.INEv2,
new TuID.INEValidation(true,true,true,true,true)
);
Parameters
The TuID.init (Context ctx, Boolean showTutorial, Boolean showResults, method m) method receives 5 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.INEv2: method that validates INE (returns validation result).
• TuID.INEValidation: Class instance for validation of (Info, Quality, Patterns, Curp, Face).
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();
}
}
}
}