Skip to main content

ID Capture

Get the id capture module from the main AmaniSDK instance which you have previously initialized.

note

The parameter on the setType function is supplied by Amani to it's customers.

useEffect(() => {
AmaniSDK.sharedInstance.idCapture.setType("TUR_ID_1").then(() => {
console.log("TYPE SET!");
});
}, []);

Give the method below to the buttons onPress

// later on your component
const onFrontStart = useCallback(() => {
AmaniSDK.sharedInstance.idCapture
.start(IDSide.front)
.then((frontImageData) => {
setFrontImage(frontImageData);
});
}, []);

This SDK returns image data as base64 string. That you can directly use with Image component.

Capturing the NFC Data on iOS

ID Capture module has it's own NFC method on iOS for making things easier. To call it you must have captured the both front and back sides of the id since capturing NFC data requires information can be extracted from the MRZ data.

// After capturing the front and back side on the IdCapture
// Before calling upload
AmaniSDK.sharedInstance.idCapture.startNFCCaptureOnIOS().then((nfcCaptureComplete) => {
// You can upload it here
AmaniSDK.sharedInstnace.idCapture.upload().then(uploadSuccess => {
setUploadSuccess(uploadSuccess)
})
})
}

Capturing the NFC data after the ID Capture on Android

On android, you must do the following steps to capturing the NFC data after the side that containing the MRZ is captured from the camera

AmaniSDK.sharedInstance.androidNFCCapture
.startNFC()
.then((state) => {
setIsCaptured(state);
AmaniSDK.sharedInstance.androidNFCCapture.stopNFCListener();
AmaniSDK.sharedInstance.idCapture.upload().then(uploadSuccess => {
setUploadSucess(uploadSuccess)
})
})
.catch((err) => console.error(err));
}

Using the setAndroidUsesNFC doesn't require you to call the setType on the AndroidNFCCapture module.

note

If you want to use the NFC as a document please check out this section.