[BETA] NFC Scan - Integration & Usage Guide
Prerequisites
- An ICAO 9303 compliant travel document to scan the NFC chip in.
NOTE
While any ICAO 9303 document could theoretically be scanned, the tutorials in the module assume the document is a Passport booklet.
Integration
In your module-level app/build.gradle, add the Incode library for NFC alongside any required dependencies. See the Library Dependencies section for more info.
Usage
To add the NFC Scan module to the flow, simply:
1) Create a new NfcScan module with its Builder class:
NfcScan module with its Builder class:val nfcScan = NfcScan.Builder()
.setShowNfcSymbolConfirmationScreen(true/false)
.setProcessNfcData(true/false)
.build()NfcScan nfcScan = new NfcScan.Builder()
.setShowNfcSymbolConfirmationScreen(true/false)
.setProcessNfcData(true/false)
.build()2) Add it to a FlowConfig.Builder:
FlowConfig.Builder:flowConfigBuilder.addNfcScan(nfcScan)flowConfigBuilder.addNfcScan(nfcScan);3) Add this callback to your IncodeWelcome.OnboardingListener:
IncodeWelcome.OnboardingListener:override fun onNfcScanCompleted(nfcScanResult: NfcScanResult) {
// NFC scan completed. Process result.
}@Override
public void onNfcScanCompleted(@NonNull NfcScanResult nfcScanResult) {
// NFC scan completed. Process result.
}Methods for NfcScan.Builder():
NfcScan.Builder():setShowNfcSymbolConfirmationScreen(): Iftrue, a screen asking the user if their document contains an NFC chip will be shown. If disabled, it's recommended to handle this case yourself to prevent a user without an NFC symbol on their passport from getting stuck. Default istrue.setProcessNfcData(): Iftrue, the data read from the NFC chip will be used to validate identity. How it's used depends on how theFaceMatchmodule is configured. Default istrue.
Returning result of the module is an NfcScanResult object which contains:
NfcScanResult object which contains:resultCode: AResultCodeindicating if scanning succeeded, or a known issue caused it to not succeed. See the Javadoc for more info.compositeCheckDigit: ACharrepresenting the digit used to check the integrity of all the data in the MRZ of the document.dateOfBirth: AStringin "yyMMdd" format of the date of birth of the document owner.dateOfBirthCheckDigit: ACharrepresenting the digit used to check the integrity of thedateOfBirthfield.dateOfExpiry: AStringin "yyMMdd" format of the document's expiration date.dateOfExpiryCheckDigit: ACharrepresenting the digit used to check the integrity of thedateOfExpiryfield.documentCode: AStringrepresenting what type of ICAO 9303 compliant document this is. For example, a passport booklet is "TD3". Can be one of: TD1-3, MRVA, or MVRB.documentNumber: AStringrepresenting the 9 most significant digits of the passport number, CIC, etc.documentNumberCheckDigit: ACharrepresenting the digit used to check the integrity of thedocumentNumberfield.gender: AStringrepresenting the gender of the document owner. Can be one of:MALE,FEMALE,UNKNOWN, orUNSPECIFIED.issuingStateOrOrganization: AStringcontaining the 3 Letter Code of which authority issued this document. For example, for US Passports, this code is: "USA".nationality: AString= AStringcontaining the 3 Letter Code of the document owner's nationality. For example, for UK Passports, this code is: "GBR".optionalData1: AStringwith the contents of the first optional data for TD-1 and 3 style MRZs.optionalData2: An optionalStringwith the contents of the second optional data for TD-1 style MRZs only.personalNumber: AStringwith the personal number of the document owner if it's encoded inoptionalData1.personalNumberCheckDigit: An optionalCharrepresenting the digit used to check the integrity of thepersonalNumberfield. This is only populated ifdocumentCodeis "TD3".primaryIdentifier: AStringrepresenting the primary means of identifying the document. Typically, this is the document owner's last name.secondaryIdentifier: AStringrepresenting secondary means of identifying the document. Typically, this is the document owner's other names besides the last.secondaryIdentifierComponents: AnArray<String>of all the individual names that make up thesecondaryIdentifier. For example, if the document owner's name is "John Jacob Jingleheimer Schmidt", thesecondaryIdentifierComponentswould be this array:["John", "Jacob", "Jingleheimer"].faceBitmap: ABitmapof the image found on the NFC chip. See the Android documentation for more info.
Face Match and NFC Scanning:
If NfcScan.Builder().setProcessNfcData() is set to true, the data read from the NFC chip will be processed on the backend and can be used in the FaceMatch module. Moreover, when NFC data is available on the backend, 2 new FaceMatch.MatchTypes become available on top of the default ID_SELFIE type:
NFC_SELFIE: Compares the image from the NFC chip to the Selfie taken in theSelfieScanmodule.NFC_3_WAY: Compares the cropped ID image from theIdScanmodule, to the image from the NFC chip, as well as the Selfie taken in theSelfieScanmodule.
Capturing Multiple IDs and NFC Scanning:
If your Flow includes capturing multiple IDs before an NFC scan is initiated, the nfc module is only supported for the first ID.
Displaying the NFC Bottom Sheet on a Transparent Background
To show the NFC scanning bottom sheet on a transparent background (so your screen remains visible during the scan), use the following configuration:
NfcScan nfcScan = new NfcScan.Builder()
.setShowTutorials(false)
.setShowNfcSymbolConfirmationScreen(false)
.setIdType(IdScan.IdType.PASSPORT) // or ID
.setShowInitialDataConfirmationScreen(false)
// ... other builder options as needed
.build();val nfcScan = NfcScan.Builder()
.setShowTutorials(false)
.setShowNfcSymbolConfirmationScreen(false)
.setIdType(IdScan.IdType.PASSPORT) // or ID
.setShowInitialDataConfirmationScreen(false)
// ... other builder options as needed
.build()License
Copyright 2025 Incode Technologies. All rights reserved.
Updated 3 days ago
