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.

Initialization

Declare the following variables

private lateinit var docKitBuilder: VIDVDocKitConfig.Builder

Initialize your SDK in your activity or fragment as follows

docKitBuilder = VIDVDocKitConfig.Builder()

Configurations

The SDK builder is separated into two components.

Make sure that you fetched the access token successfully before passing it to the Builder object.

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.passport()) // Passport

Optional 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

// UI Customization
config.setPrimaryColor("#FFA500".toColorInt())
config.setLogo(VIDVLogo.ResourceLogo(R.drawable.logo))
config.setLogo(VIDVLogo.ByteArrayLogo(byteArray))
config.setLogo(VIDVLogo.Empty()) // Hide logo

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
            }
        }
    }
})

Last updated