To add our SDK to your own application, you should add it to the build process of your application.
Currently we only support doing this using Gradle.
Adding the SDK to your gradle build file consist of two steps:
To add the repository to your gradle file, open the build.gradle file in your
application. Make sure you use the build.grade of your project, not the top-level one.
Edit the repositories part of your build.gradle, so that it contains the following:
maven {
credentials {
username 'ExampleUsername'
password 'ExamplePassword'
}
url "https://custom-ocr.klippa.com/sdk/android/maven"
}
maven { url "https://jitpack.io" }
We add jitpack.io because some of our dependencies are hosted there. If your build.gradle already
contains jitpack.io, don't add it.
The full repositories section of your build.gradle might look like
this now:
repositories {
jcenter()
maven {
credentials {
username 'ExampleUsername'
password 'ExamplePassword'
}
url "https://custom-ocr.klippa.com/sdk/android/maven"
}
maven { url "https://jitpack.io" }
}
Edit the dependencies part of your build.gradle, so that it contains the following:
implementation 'com.klippa:identity_verification:0.6.5'
The full dependencies section of your build.gradle might look like this now:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
implementation 'com.klippa:identity_verification:0.6.5'
}
When you build your app now, it should download our library as dependency, and with that all dependencies of our library.
Before you can start using the identity verification you need to generate a session token in your backend. You can then start the session using your newly generated token. Once the session has been completed you can collect the files and data read by the OCR.
To start the identity verification, import our package:
// Add to the top of your file
import com.klippa.identity_verification.modules.base.IdentityBuilder;
Then start our session from your own Activity, be sure that you implemented `IdentityBuilder.IdentityBuilderListener`:
public class MainActivity extends AppCompatActivity implements IdentityBuilder.IdentityBuilderListener {
// Call this function from a button press.
private void startIdentityVerification() {
// @todo: get a session token from the API through your backend here.
// Launch the Identity Verification session.
IdentityBuilder builder = new IdentityBuilder(this, "{insert-session-token-here}");
builder.startSession(this);
}
@Override
public void canceled() {
// User canceled, handle user interaction.
Log.w("KlippaIdentityVerification", "canceled");
}
@Override
public void finishedWithSuccess() {
// User finished with success, check result using API.
Log.w("KlippaIdentityVerification", "finished with success");
}
@Override
public void contactSupportPressed() {
// User tapped the get Support button after they failed to verify.
Log.w("KlippaIdentityVerification", "support button pressed");
}
}
class MainActivity : AppCompatActivity(), IdentityBuilder.IdentityBuilderListener {
fun startIdentityVerification() {
// @todo: get a session token from the API through your backend here.
// Launch the Identity Verification session.
val builder =
IdentityBuilder(
this, "{insert-session-token-here}"
)
builder.startSession(this)
}
override fun canceled() {
// User canceled, handle user interaction.
TODO("Not yet implemented")
}
override fun finishedWithSuccess() {
// User finished with success, check result using API.
TODO("Not yet implemented")
}
override fun contactSupportPressed() {
// User tapped the get Support button after they failed to verify.
TODO("Not yet implemented")
}
}
The SDK has a few customizing settings, the following methods are available:
IdentityBuilder.Colors colors = new IdentityBuilder.Colors();
colors.textColor = getResources().getColor(R.color.black);
colors.buttonSuccessColor = getResources().getColor(android.R.color.holo_green_light);
colors.buttonErrorColor = getResources().getColor(android.R.color.holo_red_dark);
colors.buttonOtherColor = getResources().getColor(android.R.color.holo_orange_light);
colors.backgroundColor = getResources().getColor(android.R.color.holo_red_light);
colors.progressBarBackground = getResources().getColor(android.R.color.holo_orange_light);
colors.progressBarForeground = getResources().getColor(android.R.color.holo_orange_dark);
builder.setColors(colors);
IdentityBuilder.Fonts fonts = new IdentityBuilder.Fonts();
fonts.font = R.font.avenir_black;
fonts.boldFont = R.font.avenir_black;
builder.setFonts(fonts);
// We support English, Dutch and Spanish.
builder.language = IdentityBuilder.KIVLanguage.English;
// The extracted data keys that will be shown to the user after document pictures are processed.
Default value:
List<String> includeList = new ArrayList<>(Arrays.asList(
"DateOfExpiry",
"DateOfIssue",
"DocumentNumber",
"DocumentSubtype",
"DocumentType",
"Face",
"Gender",
"GivenNames",
"Height",
"IssuingCountry",
"IssuingInstitution",
"Nationality",
"PersonalNumber",
"PlaceOfBirth",
"Residency",
"Signature",
"Surname"
));
builder.includeList = includeList;
// The extracted data keys that will be hidden for the user after document pictures are processed.
// Default value (empty):
builder.excludeList = new ArrayList<>();
builder.colors.textColor = getResources().getColor(R.color.black)
builder.colors.buttonSuccessColor = getResources().getColor(android.R.color.holo_green_light)
builder.colors.buttonErrorColor = getResources().getColor(android.R.color.holo_red_dark)
builder.colors.buttonOtherColor = getResources().getColor(android.R.color.holo_orange_light)
builder.colors.backgroundColor = getResources().getColor(android.R.color.holo_red_light)
builder.colors.progressBarBackground = getResources().getColor(android.R.color.holo_orange_light)
builder.colors.progressBarForeground = getResources().getColor(android.R.color.holo_orange_dark)
builder.fonts.font = R.font.avenir_black
builder.fonts.boldFont = R.font.avenir_black
// We support English, Dutch and Spanish.
builder.language = IdentityBuilder.KIVLanguage.English
// The extracted data keys that will be shown to the user after document pictures are processed.
Default value:
builder.includeList = mutableListOf(
"DateOfBirth",
"DateOfIssue",
"DocumentNumber",
"DocumentSubtype",
"DocumentType",
"Face",
"Gender",
"GivenNames",
"Height",
"IssuingCountry",
"IssuingInstitution",
"Nationality",
"PersonalNumber",
"PlaceOfBirth",
"Residency",
"Signature",
"Surname"
)
// The extracted data keys that will be hidden for the user after document pictures are processed.
// Default value (empty):
builder.excludeList = mutableListOf()
Because our SDK includes OpenCV, which includes native code which in turn generates a native library
(.so file) for every architecture, the APK size can increase quite a bit by using our SDK.
To minimize the impact of the SDK on your app size, you can enable APK splitting in your
build.grade, like this:
android {
// Other options
splits {
abi {
enable true
universalApk false
reset()
include 'arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64'
}
}
// Other options
}
In our example app (which contains not much more than the SDK), this resulted in the following APK files:
While creating a single APK file creates a file that is 100.8MB, since most phones
are
ARM, on average APK splitting will result in a 45MB smaller APK, in those cases
the SDK will add between 47-61MB to the APK size.
Please note that all APK files should be signed and uploaded to the Play Store to get a release that
works on all devices.
The JavaDoc of the latest version is available for download here.
The following versions are available:
Version | Gradle dependency | JavaDoc |
---|---|---|
0.6.5 | implementation 'com.klippa:identity_verification:0.6.5' | Download |
0.6.4 | implementation 'com.klippa:identity_verification:0.6.4' | Download |
0.6.3 | implementation 'com.klippa:identity_verification:0.6.3' | Download |
0.6.2 | implementation 'com.klippa:identity_verification:0.6.2' | Download |
0.6.1 | implementation 'com.klippa:identity_verification:0.6.1' | Download |
0.6.0 | implementation 'com.klippa:identity_verification:0.6.0' | Download |
0.5.2 | implementation 'com.klippa:identity_verification:0.5.2' | Download |
0.5.1 | implementation 'com.klippa:identity_verification:0.5.1' | Download |
0.5.0 | implementation 'com.klippa:identity_verification:0.5.0' | Download |
0.4.0 | implementation 'com.klippa:identity_verification:0.4.0' | Download |
0.3.0 | implementation 'com.klippa:identity_verification:0.3.0' | Download |
0.2.2 | implementation 'com.klippa:identity_verification:0.2.2' | Download |
0.2.1 | implementation 'com.klippa:identity_verification:0.2.1' | Download |
0.2.0 | implementation 'com.klippa:identity_verification:0.2.0' | Download |
0.1.0 | implementation 'com.klippa:identity_verification:0.1.0' | Download |
0.0.16 | implementation 'com.klippa:identity_verification:0.0.16' | Download |
PACE
authentication always failed.masterList
PACE
authentication failure was not being handled correctly.AndroidManifest
.DeviceDoesNotSupportNFC
to KlippaError
which is returned when NFC is required but the device does support not it.DeviceNFCDisabled
to KlippaError
which is returned when NFC is required but is disabled on the device.RequiredLivenessCount
to 0.RequiredNFCScanCount
to 1.ProGuard
might remove used classes.finished()
to identityVerificationFinished()
.canceled()
to identityVerificationCanceled(withError:)
.contactSupportPressed
to identityVerificationContactSupportPressed()
.kiv_no_camera_permission
to always appear if no permission to camera was granted. (Before it only showed for 3.5 seconds)builder.isDebug = true
). Please note that due to this change you will have also have to call the production API (https://custom-ocr.klippa.com) from your backend.contactSupportPressed()
builder.includeList
and builder.excludeList