DOT Android NFC 9.0.0
This guide describes how to migrate DOT Android NFC version 8.x to version 9.0. Only the most important changes are highlighted in this guide. For more details, see the Android Samples.
Migration Steps
Compatibility with DIS
When utilizing DIS for server-side evaluation, ensure compatibility between your DIS version and the corresponding SDK version. Refer to the DIS vs SDKs compatibility table for detailed compatibility information.
SDK initialization
The way DOT SDK libraries are configured has changed.
- Replace
DotSdkConfigurationwithDotSdk.Configurationclass. - Update
librariesproperty ofDotSdk.Configurationclass.
Before
Libraries were provided as a list of DotLibrary instances.
DotSdkConfiguration(
//...
libraries = listOf(
DotNfcLibrary(),
//...
)
)
After
Libraries are now configured via a single Libraries object, with explicit configuration for each DOT SDK library.
DotSdk.Configuration(
//...
libraries = Libraries(
nfc = DotNfcLibraryConfiguration,
//...
)
)
UI NFC Travel Document Reader
The configuration structure of the NfcTravelDocumentReaderFragment has changed. Existing configuration objects are not compatible with the new API and must be migrated to the new configuration model.
Before
class BasicNfcTravelDocumentReaderFragment: NfcTravelDocumentReaderFragment {
override fun provideConfiguration(): Configuration {
return Configuration(
nfcKey = NfcKey(
documentNumber = "...",
dateOfExpiry = "...",
dateOfBirth = "...",
),
sessionToken = "...",
)
}
}
After
class BasicNfcTravelDocumentReaderFragment: NfcTravelDocumentReaderFragment {
override fun provideConfiguration(): Configuration {
return Configuration(
password = Password.MachineReadableZone(
documentNumber = "...",
dateOfExpiry = "...",
dateOfBirth = "...",
),
common = CommonConfiguration(
sessionToken = "...",
),
//...
)
}
}
NFC Travel Document Reader
Basic migration steps:
- Replace
NfcTravelDocumentReaderConfigurationwith the inner classNfcTravelDocumentReader.Configuration. - Exceptions thrown by
NfcTravelDocumentReader.read(...)methods are now defined as inner classes ofNfcTravelDocumentReader. Update all exception handling to use these new inner exception classes instead of the previously thrown exceptions. - Replace all
NfcTravelDocumentReader.read(...)methods that previously accepted anNfcKeyargument with the new methods that accept aPasswordinstead.
Before
val reader = NfcTravelDocumentReaderFactory.create(
configuration = NfcTravelDocumentReaderConfiguration(
//...
)
)
val nfcKey = NfcKey(
documentNumber = "...",
dateOfExpiry = "...",
dateOfBirth = "...",
)
try {
reader.read(tag, nfcKey)
} catch (accessControlException: AccessControlException) {
//...
} catch (chipAuthenticationException: ChipAuthenticationException) {
//...
} catch (notConnectedException: NotConnectedException) {
//...
} catch (nfcTravelDocumentReaderException: NfcTravelDocumentReaderException) {
//...
}
After
val reader = NfcTravelDocumentReaderFactory.create(
configuration = NfcTravelDocumentReader.Configuration(
//...
)
)
val password = Password.MachineReadableZone(
documentNumber = "...",
dateOfExpiry = "...",
dateOfBirth = "...",
)
try {
reader.read(tag, password)
} catch (accessControlException: NfcTravelDocumentReader.AccessControlException) {
//...
} catch (chipAuthenticationException: NfcTravelDocumentReader.ChipAuthenticationException) {
//...
} catch (notConnectedException: NfcTravelDocumentReader.NotConnectedException) {
//...
} catch (nfcTravelDocumentReaderException: NfcTravelDocumentReader.ReadException) {
//...
}