Read information and face image from passports equipped with an NFC (near field communication) chip using an Android device.
Add the following dependency in your module's build.gradle file:
dependencies {
implementation 'com.appliedrec:mrtd-reader:3.0.2'
}To read a passport you will first need to obtain the following:
- Document number
- Date of birth of the passport holder
- The passport's date of expiry
You can use a library like Microblink's BlinkID to read the machine-readable zone (MRZ) on the passport or you can let the user enter the above information.
Once you have the document number, date of birth and date of expiry, you can start a passport scan session from your activity:
class MyActivity : AppCompatActivity() {
fun scanPassport(
documentNumber: String, // Document (passport) number
dateOfBirth: Date, // Passport holder's date of birth
dateOfExpiry: Date // Passport's expiry date
) {
val bacSpec = BACSpec(documentNumber, dateOfBirth, dateOfExpiry)
passportScanner.launch(MRTDScanSettings(bacSpec))
}
private val passportScanner = registerForActivityResult(MRTDReaderActivityResultContract()) { result ->
when (result) {
is MRTDScanResult.Success -> {
TODO("Handle success result")
}
is MRTDScanResult.Failure -> {
TODO("Handle error")
}
else -> {}
}
}
}The project contains a sample application in the module called testapp. The application shows how to use the rVer-ID SDK to capture a selfie and compare it to the face from the passport's NFC chip.
API documentation is available in the docs folder.