Implementation Guide
Authentication
A unique access token should be created upon each SDK entry. In order to generate an access token, please refer to Valify's Authentication Documentation.
Security Warning: For improved security, consider implementing the access token fetching logic outside the Activity. This helps keep sensitive credentials secure and reduces potential exposure within the Activity/Fragment code.
Initialization
Declare the following variables
private lateinit var docKitBuilder: VIDVDocKitConfig.Builderprivate VIDVDocKitConfig.Builder docKitBuilder;Initialize your SDK in your activity or fragment as follows
docKitBuilder = VIDVDocKitConfig.Builder()docKitBuilder= new VIDVDocKitConfig.Builder();Configurations
The SDK builder is separated into two components.
Required Configurations
docKitBuilder
.setBaseUrl("Base Url") // add your actual base url
.setAccessToken("Access Token") // add the fetched access token here
.setBundleKey("Bundle Key") // add your actual bundle key
.setDocumentType(VIDVDocKitDocType.<your chosen doc type>()) //avaliable doc types: passport - egyNID - tunNID -dzaNIDdocKitBuilder
.setBaseUrl("Base Url"); //add your actual base url
.setAccessToken("Access Token"); //add the fetched access token here
.setBundleKey("Bundle Key"); //add your actual bundle key
.setDocumentType(VIDVDocKitDocType.passport()); //avaliable doc types: passport - egyNID - tunNID - dzaNIDOptional Configurations
.setLanguage("en") // or "ar"
.setCollectUserInfo(true) // enable location permissions if true
.previewCapturedImage(true) // show preview of captured image
.reviewData(true) // show a review screen before finishing
.manualCaptureMode(true) // enable manual capture
.setExtras(
mapOf(
"advancedConfidence" to true,
"professionAnalysis" to true,
"documentVerificationPlus" to true,
"documentLiveness" to true
)
)
// UI Customization
config.setPrimaryColor("#FFA500".toColorInt())
config.setLogo(VIDVLogo.ResourceLogo(R.drawable.logo))
config.setLogo(VIDVLogo.ByteArrayLogo(byteArray))
config.setLogo(VIDVLogo.Empty()) // Hide logo
docKitBuilder.setLanguage("en"); // or "ar"
docKitBuilder.setCollectUserInfo(true); // enable location permissions if true
docKitBuilder.setPreviewCapturedImage(true); // show preview of captured image
docKitBuilder.setReviewData(true); // show a review screen before finishing
docKitBuilder.setManualCaptureMode(true); // enable manual capture
// UI Customization
docKitBuilder.setPrimaryColor(Color.parseColor("#FFA500")); // Convert hex to int color
// Set logo (choose one based on your use case)
docKitBuilder.setLogo(new VIDVLogo.ResourceLogo(R.drawable.logo));
// or
docKitBuilder.setLogo(new VIDVLogo.ByteArrayLogo(byteArray));
// or
docKitBuilder.setLogo(new VIDVLogo.Empty()); // Hide logoConfigurations Breakdown
1. Sets the base URL used by the SDK to communicate with your backend APIs.
.setBaseUrl("Base Url") 2. Sets the access token required for authenticating SDK API requests.
.setAccessToken("Access Token") // add the fetched access token here3. Associates the session with your account using a unique bundle key.
.setBundleKey("Bundle Key") // add your actual bundle key4. Specifies the type of document to be captured by the SDK.
Available options:
passport()egyNID()tunNID()dzaNID()
.setDocumentType(VIDVDocKitDocType.passport())5. Sets the interface language used throughout the SDK experience.
Supported languages:
"en"for English"ar"for Arabic
.setLanguage("en")6. Enables the collection of user info like location. Requires location permission in manifest.
.setCollectUserInfo(true)7. Enables image preview after capture so users can confirm or retake it.
.previewCapturedImage(true)8. Displays a data review screen before submitting the final result.
.reviewData(true)9. Enables manual capture mode for users instead of automatic capture.
.manualCaptureMode(true)10. Sets your brand’s primary color in the SDK UI. Use a hex color string.
.setPrimaryColor(Color.parseColor("#FFA500"))11. Displays your logo in the SDK UI using a drawable resource from your app.
.setLogo(VIDVLogo.ResourceLogo(R.drawable.logo))12. Displays your logo using a byte array (e.g., from a file or server).
.setLogo(VIDVLogo.ByteArrayLogo(byteArray))13. Hides Valify's logo entirely from the SDK UI.
.setLogo(VIDVLogo.Empty())Start SDK
Use the following code snippet to run the SDK
config.start(this, object : VIDVDocKitListener {
override fun onDocKitResult(result: VIDVDocKitResponse) {
when (result) {
is VIDVDocKitResponse.Success -> {
// Handle success
}
is VIDVDocKitResponse.ServiceFailure -> {
// Handle failure
}
is VIDVDocKitResponse.BuilderError -> {
// Handle builder error
}
is VIDVDocKitResponse.Exit -> {
val step = result.step // screen where user exited
}
}
}
})
config.start(this, new VIDVDocKitListener() {
@Override
public void onDocKitResult(VIDVDocKitResponse result) {
if (result instanceof VIDVDocKitResponse.Success) {
// Handle success
} else if (result instanceof VIDVDocKitResponse.ServiceFailure) {
// Handle failure
} else if (result instanceof VIDVDocKitResponse.BuilderError) {
// Handle builder error
} else if (result instanceof VIDVDocKitResponse.Exit) {
VIDVDocKitResponse.Exit exitResult = (VIDVDocKitResponse.Exit) result;
String step = exitResult.getStep(); // screen where user exited
}
}
});
Last updated