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:

Java
Kotlin
Copy
  1. 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:
Java
Kotlin
Copy

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.

  1. Finally, you can start the Onboarding process by calling 'start()' function of the TrustSDK:
Java
Kotlin
Copy

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 NameCodeDescription
qrScanInvalidQRCode200103Scanned QR code is not valid.
qrScanInterrupted200104QR scanning interrupted. Please try again.
webSessionExpired200401Web session for onboarding process has expired.
webAppTerminated200402Web 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.
webAppTimeout200403Web application process has timed out.
webSessionCompleted100403Web session for onboarding process completed successfully.
cameraPermissionDenied200501Camera permission denied.
noInternetConnection200502Internet connection not available.
versionNotCompatible200505DaonTrust SDK client version not compatible with server version.
urlNotWhitelisted200508Provided URL is not whitelisted.
webLoadingTimeout200509Web 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 NameDescription
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 NameDescription
String serverUrlServer URL that will be used to initialize the Trust SDK.
Long initializationTimeoutThe allotted wait time for the Trust SDK to initialize. Default value is 10 seconds (10000L).
Boolean enableConsoleLogsOption to enable logs reported by the SDK.
String nfcLicenseOptional parameter that is used to set the NFC SDK license file name.
String qrInstructionLabelDescription label in QR scan screen. If not set, the label will not be shown.
String spinnerLabelOptional parameter that is used to set the custom spinner label that will be shown beneath the progress while Daon Trust SDK is loading.
Boolean whitelistCheckEnabledOptional parameter that should be used to enable/disable whitelisted URLs check.
Boolean webLoadedCheckEnabledOptional parameter that is used to enable/disable waiting for webLoaded() callback.
Boolean isAnalyticsEnabledOptional 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 NameDescription
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 NameDescription
DaonEventCode codeField that contains event code.
String descriptionField that contains description/reason of the event.
Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard