Using the Android Trust SDK
This guide is written for developers who want to use the Trust SDK to add local (on-device) Onboarding capabilities to an Android application.
The developer needs a thorough knowledge of the Java and/or Kotlin programming language on the Android platform. It is also recommended that the developer has some understanding of TrustX Webview technology.
The minimum supported Android version is Android 5.
Initializing the Trust SDK
DaonTrustSDK daonTrustSDK = new DaonTrustSDK(this, new DaonEventListener() {
public void onFail(DaonEvent event) {
...
}
public void onInfo(DaonEvent event) {
...
}
public void onSuccess(String description) {
// On successful completion, get the Process Instance status. See Step 7.
}
}
);
getLifecycle().addObserver(daonTrustSDK);
- Daon Trust SDK offers setting a DaonOptions object for customization purposes. You can set your own initialization timeout as well as the URL of the environment that you want to use:
DaonOptions options = new DaonOptions();
options.setServerURL("https://www.example.com");
options.setInitializationTimeout(15000L); //initialization timeout is expressed in milliseconds
f you do not set the DaonOptions object, default values will be used. Initialization timeout default value is '10000L'. By not setting the custom environment URL, you are requesting of the Daon Trust SDK to launch a QR code scanning feature which expects the QR code that carries the URL of your environment as a value.
- Finally, you can start the Onboarding process by calling 'start()' function of the TrustSDK:
daonSDK.start(options);
Obtaining and Parsing Events from the Trust SDK
As stated above, the Trust SDK returns events through the two callback methods ('onInfo()' and 'onFail()') that need to be overridden to initialize the SDK. Events that are returned are represented through the DaonEvent object instances that are carrying feedback information about the Onboarding process status and errors.
- DaonEvent fields:
- DaonEventCode code - field that contains event code
- String description - field that contains a description of the event
A list of events, their codes and descriptions that are supported and provided by the Daon Trust SDK can be found below:
Event Name | Code | Description |
---|---|---|
qrScanInvalidQRCode | 200103 | Scanned QR code is not valid. |
qrScanInterrupted | 200104 | QR scanning interrupted. Please try again. |
webSessionExpired | 200401 | Web session for onboarding process has expired. |
webAppTerminated | 200402 | Web application process terminated. This can occur when the end-user presses the back button to navigate to a previous screen when they are on the first web screen of the Process Instance. |
webAppTimeout | 200403 | Web application process has timed out. |
webSessionCompleted | 100403 | Web session for onboarding process completed successfully. |
cameraPermissionDenied | 200501 | Camera permission denied. |
noInternetConnection | 200502 | Internet connection not available. |
versionNotCompatible | 200505 | DaonTrust SDK client version not compatible with server version. |
urlNotWhitelisted | 200508 | Provided URL is not whitelisted. |
webLoadingTimeout | 200509 | Web page failed to load in given time frame. |
- DaonEventCode structure breakdown:
- First pair of digits represents event status. Event status can be: Success (10), Fail (20), Info (30).
- Second pair of digits represents section of the event. Event sections can be: QR (01), MRZ (02), NFC (03), Web (04), Other (05).
- Third pair of digits represents ordinal code number for that section.