Skip to main content

ID Capture

The IDCapture module offers you the opportunity to automatically capture the document and upload it. According to the upload rtesult, you can listen wherether the document is approved or not.

Starting the Capture

start method returns a Fragment of the IDCapture.

note

docType parameter here is supplied by Amani to it's customers.

val fragment: Fragment? = Amani.sharedInstance().IDCapture().start(
this, //Context of the Application
frameLayout, //FrameLayout where the current IDCapture fragment will be fit in
docType, // Type of the document
false // Boolean value for frontSide/backSide, set true for frontSide, set false for backSide
) { bitmap: Bitmap?, b: Boolean?, file: File? ->

bitmap?.let {
//Current document is captured, upload method of current module can be triggered.

}
}
replaceFragmentWithBackStack(R.id.id_frame_layout, fragment!!)

Setting the Manual Crop timeout

The setManualCropTimeout() sets the manual capture button of the IDCapture fragment for the situations where AutoCapture can fail. When the manual crop button is enabled, user will have a chance to capture the document manually for unexpected situations.

If you did not called this method. It will use the default value as 30 seconds.

// You don't need to call this as the default manual crop timeout is
// 30 seconds.
Amani.sharedInstance().IDCapture.setManualCropTimeout(30)

Getting the MRZ Data for Scanning the NFC

The getMRZ() method fetches the required data groups for scanning the NFC.

note

This method is used to capture the NFC Data Group required for the NFC Scanning in cases where only the back side is taken. It is optional as you don't need the call this method if you have the required data for scanning the NFC.

note

docType is supplied by Amani to it's customers.

        Amani.sharedInstance().IDCapture().getMRZ(
type = docType,
onComplete = { mrz ->
/* Mrz model will be fetched in this section. This data model contains required values
for scanning NFC.

For scanning NFC with the response of Mrz request, the following values can be used in ScanNFC.start(_,_,_) function ->

mrz.mrzBirthDate,
mrz.mrzExpiryDate,
mrz.mrzDocumentNumber

*/
},
onError = {

}

)

Uploading the captured document

The upload method has to be called after both front and back sides, and if using nfc capture, after the nfc capture process is completed. Otherwise, you'll encounter with an Error() object after the upload function is called.

[!IMPORTANT]
If the captured identity document contains NFC and this document is desired to be uploaded together with NFC, the following withNFC(true) method is set to true before upload, ensuring that the NFC data and the captured document are uploaded together as a single document.

Amani.sharedInstance().IDCapture().withNFC(true/false)
Amani.sharedInstance().IDCapture().upload(
this, // Context of the Application/Activity
docType, // Document type, supplied by Amani
object : IUploadCallback {
override fun cb(isSuccess: Boolean, result: String? errors: MutableList<Errors>?) {
// TODO: Do something
}
}
)