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.
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!!)
Configuration Settings
The hologramDetection(hologramDetection: Boolean = false)
function enables or disables the detection of holograms during the ID capture process. When hologram detection is enabled, the system will actively analyze the document for holograms, improving the accuracy of detection in cases where holographic elements are present. This feature is particularly useful for documents with security features that may otherwise affect the capture process. If disabled, the capture process will proceed without checking for holograms, allowing for faster processing but with less accuracy for documents containing holograms. It should be called just before the Amani.sharedInstance().IDCapture..start(...) function.
Amani.sharedInstance().IDCapture().hologramDetection(true)
The videoRecord(isRecording: Boolean = true)
function enables or disables the video recording feature during the ID capture process. When video recording is enabled, the system will continuously record the capture session, which can be useful for auditing or additional analysis. If disabled, the capture will proceed without recording, allowing for a streamlined process without the overhead of video storage.
Amani.sharedInstance().IDCapture().videoRecord(true)
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. It must be called just before the Amani.sharedInstance().IDCapture..start(...) function.
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)
The setIsMRZReaderEnabled(enable: Boolean = true)
function controls whether the MRZ (Machine Readable Zone) reader is enabled during the ID capture process. When enabled, the system will scan and extract data from the MRZ section of the document, improving accuracy and efficiency for documents with this feature. If disabled, MRZ scanning is skipped, allowing for a simplified capture process in cases where MRZ data is not required. It must be called just before the Amani.sharedInstance().IDCapture..start(...) function.
Amani.sharedInstance().IDCapture().setIsMRZReaderEnabled(true)
The withNFC(withNFC: Boolean = false)
function determines whether NFC data should be combined with the ID capture data during the upload process. When enabled, the system will merge both NFC and captured ID data into a single document for upload, ensuring that all available information is consolidated. If disabled, only the ID capture data is uploaded without the additional NFC data. It must be called just before the Amani.sharedInstance().IDCapture().upload(...) function. In this way, the relevant upload process is carried out with NFC.
Amani.sharedInstance().IDCapture().withNFC(true)
Getting the MRZ Data for Scanning the NFC
The getMRZ()
method fetches the required data groups for scanning the NFC.
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.
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,
docType
) { isSuccess ->
if (isSuccess) {
Log.i(TAG, "ID is upload succceed")
} else {
Log.i(TAG, "ID upload is not succeed")
}
}