Title
Create new category
Edit page index title
Edit category
Edit link
Android Trust SDK Native Interface
Using the Android Trust SDK
This section is written for developers who want to use the Trust SDK to add local (on-device) authentication and identity verification 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() { @Override public void onFail(DaonEvent event) { ... } @Override public void onInfo(DaonEvent event) { ... } @Override 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 millisecondsf 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.
Native Interface
This sections describes all classes that represent the public API interface between mobile developer integrators and the Daon Trust SDK.
DaonTrustSDK
| Method Name | Description |
|---|---|
| DaonTrustSDK(ComponentActivity activity, DaonEventListener listener) | Default constructor that requires host activity and DaonEventListener as a Trust SDK event listener. |
| void start(DaonOptions options) | Starts the onboarding flow with SDK options object. |
| void stop() | Terminates the onboarding flow and triggers the failure callback with the event DaonEventCode.SDK_STOPPED_PROGRAMATICALLY`` |
DaonOptions
| Field Name | Description |
|---|---|
| String serverUrl | Server URL that will be used to initialize the Trust SDK. |
| Long initializationTimeout | The allotted wait time for the Trust SDK to initialize. Default value is 10 seconds (10000L). |
| Boolean enableConsoleLogs | Option to enable logs reported by the SDK. |
| String nfcLicense | Optional parameter that is used to set the NFC SDK license file name. |
| String qrInstructionLabel | Description label in QR scan screen. If not set, the label will not be shown. |
| String spinnerLabel | Optional parameter that is used to set the custom spinner label that will be shown beneath the progress while Daon Trust SDK is loading. |
| Boolean whitelistCheckEnabled | Optional parameter that should be used to enable/disable whitelisted URLs check. |
| Boolean webLoadedCheckEnabled | Optional parameter that is used to enable/disable waiting for webLoaded() callback. |
| Boolean isAnalyticsEnabled | Optional parameter that indicates whether analytics events collection feature is enabled/ disabled. Default value: TRUE |
| String (nullable) statusBarColor | Optional parameter that is used to change the color of the status bar. Accepts a hex color value as a String, supporting ARGB (Alpha, Red, Green, Blue) format. example: "#00FFAABB". Default value is null. |
| String progressBarTintColor | Optional parameter used to change the color of the loading spinner. Accepts a hex color value as a String, supporting ARGB (Alpha, Red, Green, Blue) format. example: "#00FFAABB". Default value is "#2B95E7". |
DaonEventListener
| Method Name | Description |
|---|---|
| void onFail(DaonEvent event) | Termination event - This will be triggered if a critical event occurs and the user is unable continue the flow. Additional data will be provided through the event object. |
| void onInfo(DaonEvent event) | This event allows the integrator to monitor the SDK’s progress, including events like BACK_BUTTON_PRESSED``, triggered whenever the back button is pressed. |
| void onSuccess(String description) | This method receives a parameter that contains a message from the WebApp. The message can carry any information the WebApp chooses to provide. While it often includes the status of the onboarding submission, the parameter is not limited to status and may represent other forms of data as needed. |
DaonEvent
| Field Name | Description |
|---|---|
| DaonEventCode code | Field that contains event code. |
| String description | Field that contains description/reason of the event. |