Non-Seamless Flow - Android

This section provides step-by-step procedure for integrating the Tridentity SDK into an Android application using the non-seamless flow. In this approach, the SDK handles both the business logic and the UI rendering while supporting configuration for app-specific themes.

1. Gradle Changes

Add the required dependencies to your app's build.gradle file:

android {
    dependencies {
        implementation files('libs/<Tridentity_SDK>.aar')
        
        // Other required dependencies for Tridentity SDK
        implementation 'androidx.core:core-ktx:1.6.0'
        implementation 'androidx.appcompat:appcompat:1.6.1'
        implementation 'androidx.biometric:biometric:1.1.0'
        implementation 'org.bouncycastle:bcprov-jdk15+:1.46'
        implementation 'com.nimbusds:nimbus-jose-jwt:7.4'
        implementation 'com.squareup.retrofit2:retrofit:2.6.0'   
        implementation 'com.squareup.retrofit2:converter-gson:2.6.0'
        implementation 'com.squareup.okhttp3:logging-interceptor:4.9.0'   
        implementation 'com.scottyab:rootbeer-lib:0.1.1'   
        implementation 'com.google.android.material:material:1.3.0'
        implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.29'
        implementation 'com.romainpiel.shimmer:library:1.4.0@aar'
        implementation 'com.airbnb.android:lottie:5.0.3'
        implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
        implementation 'in.payu:payuanalytics:1.5.3'  
        implementation 'in.payu:payu-crash-logger:(1.1.1,1.2.0)'
        implementation 'androidx.navigation:navigation-ui-ktx:2.4.1'
        implementation 'androidx.navigation:navigation-fragment-ktx:2.4.1’
    }                
}

2. Manifest Changes

Tridentity SDK supports different modes of authenticating a transaction. As per business needs,  permission has to be provided in App manifest to proceed with  Tridentity  SDK services. Table 1.1 shows the permissions needed as per the modes enabled

Modes supported in the SDK:

  1. Push Notification

  2. Push with Biometric

  3. Offline OTP

Permission

Description

Mandatory for Modes

Post notification conditional

Mandatory for version13 and above to receive push notification

  1. Push Notification
  2. Push with Biometric

Phone State
mandatory

Mandatory to detect sim swap scenarios

  1. Push Notification
  2. Push with Biometric
  3. Offline OTP

SMS
conditional

For auto send of SMS if SDK is enabled for binding the device

  1. Push Notification
  2. Push with Biometric
  3. Offline OTP

Add the following permissions to your app's AndroidManifest.xml file:

<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.SEND_SMS" />

3. Configuration of SDK

Invoke the following method of the SDK to configure the client details. All the security checks and mandatory permissions required for the SDK will be validated during this call.  In case if any security check fails or permission not granted, specific error message will be provided in the callback and the calling app should terminate the flow by showing appropriate message to the user.

Configure the SDK with client details using the appropriate parameters. This configuration validates security checks and permissions.

Parameters

Parameter & Constraints

Remarks

Mandatory for Modes

context mandatory

Application Context

All

clientId mandatory

Will be shared offline

All

env mandatory

Default - UAT. For production, to be passed as "PROD"

All

themeConfigoptional

Theme config which can be configured in the SDK. If not passed, configuration set in the server or default value set in the SDK will be taken. Refer table A.1 for more details.

Sample Configuration

Sample JSON:  

val configObject = JSONObject()  

configObject.put("env", "UAT") // UAT or PROD 

configObject.put("clientId", "")   

configObject.put(“themeConfig”, “{themeConfig}”) 


Sample Code:  

TridentitySDK.getInstance().configSdk(context, configObject, object : ConfigStatusCallback{ 

             override fun onSuccess(event: JSONObject) {

                } 

  

                override fun onError(errorCode: Int, errorDesc: String) { 

                 } 

            }) 
📘

Note:

· From the response event in the onSuccess method check for the message flag to get Configuration status. 

4. Set SIM Information (Conditional)

This method allows the client application to provide SIM-specific information (subscription ID and SIM index) to the SDK.

Enables the SDK to perform cross-verification of SIM information

Facilitates automatic deregistration when SIM movement/changes are detected

Sample JSON: 

val jsonObject = JSONObject()  

jsonObject.put("subscriptionId", 1)  //subscription id from subscritionInfo 

jsonObject.put("simIndex", 0)  // As per user SIM selection 

TridentitySDK.getInstance().setSimInfo(activity, jsonObject)

5. Initialization of FCM

This section details how to pass the FCM token to the SDK for sending push notifications. This method should be called before initiating registration and whenever a new FCM token is generated.

It is applicable only if the authentication mode enabled is either "Push notification" or "Push with Biometric."

Parameters

Parameter

Description

context mandatory

Application Context

fcmToken mandatory

Token generated by Firebase Messaging service

Code Example

TridentitySDK.getInstance().registerFCM(applicationContext, token,
    object : FCMRegistrationCallback {
        override fun onSuccess(event: JSONObject) {
            Log.d("TAG", "onSuccess: $event")
        }

        override fun onError(code: Int, error: String) {
            // Handle error
        }
    }
)

6. Customer Enrolment

This section details the process of enrolling a user for Tridentity authentication.

Parameters

Parameter

Description

activity mandatory

Instance of AppCompatActivity

mobileNumber conditional

Mobile number of the user against which the card is registered prefixed with country code.

cif conditional

CIF number of the user against which the card is registered.

Code Example

Sample JSON:  

val regObject = JSONObject()  

regObject.put("mobileNumber", "919999999999")  

Sample Code:  

   TridentitySDK.getInstance().initiateRegistration( 

                           activity, regObject, 

                         object :RegistrationStatusCallBack{ 

                                override fun onSuccess(event: JSONObject) { 

                                } 

                                override fun onError(code: Int, error: String) { 

                                  } 

             }) 

📘

Note:

From the response object in the onSuccess method, check for the message flag to get the status.     

7. Check Registration Status

Use this method to check the current registration status of a user in the Tridentity system.

Parameters

Parameter

Description

context mandatory

Application Context

clientId mandatory

Client ID

mobileNumber conditional

Mobile number of the user against which the card is registered prefixed with country code

cif conditional

CIF number of the user against which the card is registered.

Code Example

Sample JSON:  

val custObject = JSONObject()  

custObject.put("mobileNumber", "919999999999")  

 

TridentitySDK.getInstance().checkRegistrationStatus( context, custObject, object : RegistrationStatusCallBack { 

                override fun onSuccess(event: JSONObject) { 

        // Note: customerStatus : registration_comm_success is only considered as successful Registration.  
  }       

  override fun onError(code:Int,error: String) { 

                  } 

 })  

8. Process Transaction

This method is used to authenticate transactions through the Tridentity SDK.

Parameters

Parameter & Constraints

Remarks

Mandatory for Modes

context mandatory

Context of the transaction.

All

remoteMessage mandatory

Message received from push notification

  1. Push notification
  2. Push with Biometric

buildNotification Optional

Default value: False
To be passed as True if SDK needs to render the Push notification

  1. Push notification
  2. Push with Biometric

Code Example

TridentitySDK.getInstance().processTransaction( 

                            applicationContext, remoteMessage.data, false,

                            object : UpdateTransactionCallback { 

                                override fun onSuccess(event: JSONObject) { 

                                    Log.v("processTransaction", onSuccess) 

                                } 

                                override fun onError(error: String) { 

                                    Log.e("processTransaction" , error) 

                                } 

                         })

9. Transaction History

Invoke this method to get the transaction data authenticated via Tridentity SDK. By default, 50 transactions can be viewed, with a limit of 10 and an offset of 4.

Parameters

Parameter

Description

activity mandatory

Instance of AppCompatActivity

limit optional

Number of transaction records fetched per single request. Default is 10 records per request.

offset optional

Page index. Default is 0-4.

Sample JSON

val historyObject = JSONObject()  

historyObject.addProperty("limit ", 10)  

historyObject.addProperty("offset", 0) 

Code Example

TridentitySDK.getTransactionHistory( 

                    activity as AppCompatActivity, historyObject, 

                    transactionHistoryCallback ) {

override fun onSuccess(event: JSONObject) { 

                                } 

                                override fun onError(error: String) { 

                                } 
}

10. De-Registration

Invoke this method to deregister a customer from Tridentity.

TridentitySDK.getInstance().deRegistration(
    context, 
    object : DeregisterCallBack {
        override fun onSuccess(event: JSONObject) {
            // Handle success
        }
        
        override fun onError(code: Int, error: String) {
            // Handle error
        }
    }
)


UI Customization

The SDK allows UI customizations through a configuration object passed in as themeConfig.

UI Customization Parameters

Parameter Description Example
LabelCustomization
optional
Configurations: HeaderCustomization,TextCustomization. Sub Components: textColor, fontSize labelConfigObject
ToolbarCustomization
optional
Configurations: backgroundColor, textColor, fontSize toolbarConfigObject
ButtonCustomization
optional
Configurations: primaryButtonCustomization, secondaryButtonCustomization. Sub Components: enabledBackgroundColor, enabledTextColor, disabledBackgroundColor, disabledTextColor, fontSize, cornerRadius buttonConfigObject

Text Customization Parameters

Parameter

Description

Example

bottomSheetPermissionPopupConfiguration
optional

Text customization for permission popup: topHeaderText,topSubHeaderText, headerTextForContents, subTextForContents, buttonTextForAllowPermissions, buttonTextForSkipPermissions

permissionPopupConfig

bottomSheetSimBindingProcessingPopupConfiguration
optional

Texts for SIM binding, number verification, biometric setup, etc.

topHeaderText,
topSubHeaderText,
headerTextForContents,
subTextForContents,
numberVerificationProcessingText,
numberVerifiedText,
biometricSetupText,
biometricVerifiedText,
processingCircleColor

simBindingConfig

bottomSheetRegistrationSuccessfulPopupConfiguration
optional

Success messages and buttonText
topHeaderText,
topSubHeaderText,
headerTextForContents,
subTextForContents,
buttonText, buttonColor

registrationSuccessConfig

bottomSheetFailureScreenConfiguration
optional

Error messages and buttonText
topHeaderText,
topSubHeaderText,
headerTextForContents,
subTextForContents,
buttonText, buttonColor

failureScreenConfig

TncScreenConfiguration
optional

tncPopUpOkButtonText

ConsentScreenConfiguration
optional

consentPopUpSkipButtonText,
consentPopUpRegisterButtonText

DeRegPopupConfiguration
optional

topSubHeaderText,
headerTextForContents,
subTextForContents,
okButtonText,
cancelButtonText,

TransactionHistoryScreenConfiguration
optional

appBarText,
topHeaderText


Sample for ThemeConfig

var themeConfig = ThemeConfig()

var uICustomization = UICustomization()
var textCustomization = TextCustomization()

var labelCustomization = LabelCustomization()
var toolbarCustomization = ToolbarCustomization()
var buttonCustomization = ButtonCustomization()

toolbarCustomization.backgroundColor = "#25272C"
toolbarCustomization.textColor = "#1be077"
toolbarCustomization.fontSize = 10F

labelCustomization.headingCustomization?.textColor = "#000000"
labelCustomization.headingCustomization?.fontSize = 18F
labelCustomization.subHeadingCustomization?.textColor = "#000000"
labelCustomization.subHeadingCustomization?.fontSize = 14F

buttonCustomization.fontSize = 18F
buttonCustomization.buttonCornerRadius = 50
buttonCustomization.primaryButtonCustomization?.enabledBackgroundColor = "#9C27B0"
buttonCustomization.primaryButtonCustomization?.disabledBackgroundColor = "#F26522"
buttonCustomization.primaryButtonCustomization?.enabledTextColor = "#FFFFFF"
buttonCustomization.primaryButtonCustomization?.disabledTextColor = "#FFFFFF"

buttonCustomization.secondaryButtonCustomization?.enabledBackgroundColor = "#9C27B0"
buttonCustomization.secondaryButtonCustomization?.disabledBackgroundColor = "#F26522"
buttonCustomization.secondaryButtonCustomization?.enabledTextColor = "#FFFFFF"
buttonCustomization.secondaryButtonCustomization?.disabledTextColor = "#FFFFFF"


uICustomization.labelCustomization = labelCustomization
uICustomization.buttonCustomization = buttonCustomization
uICustomization.toolbarCustomization = toolbarCustomization
textCustomization.tncScreenConfiguration?.tncPopUpOkButtonText="OK"
textCustomization.consentScreenConfiguration?.consentPopUpSkipButtonText="skip now"
textCustomization.consentScreenConfiguration?.consentPopUpRegisterButtonText="Register"


textCustomization.deRegPopupConfiguration?.topSubHeaderText="ABC"
textCustomization.deRegPopupConfiguration?.headerTextForContents = "De-Register"
textCustomization.deRegPopupConfiguration?.subTextForContents =
    "This action will De-Register from Secure Pay. Is this what you intended to do?"
textCustomization.deRegPopupConfiguration?.okButtonText = "OK"
textCustomization.deRegPopupConfiguration?.cancelButtonText = "Cancel"

textCustomization.transactionHistoryScreenConfiguration?.appBarText = "Swipe to Pay"
textCustomization.transactionHistoryScreenConfiguration?.topHeaderText = "Authentication History"
textCustomization.transactionHistoryScreenConfiguration?.topSubHeaderText = "abc"
textCustomization.transactionHistoryScreenConfiguration?.headerTextForContents = "abc"
textCustomization.transactionHistoryScreenConfiguration?.subTextForContents = "text"
textCustomization.transactionHistoryScreenConfiguration?.bottomBarTransactionsText = "Transactions"
textCustomization.transactionHistoryScreenConfiguration?.bottomBarOfflineOTPText = "Offline OTP"

themeConfig.uiCustomization = uICustomization
themeConfig.textCustomization = textCustomization

 json.put("themeConfig", themeConfig)

Logo Configuration

Centralize your branding assets in one place. LogoConfig holds drawable resource IDs for:

Configurations :

defaultLogo = Bank Logo displayed everywhere roundedLogo = Rounded Bank Logo displayed in Swipe to Pay Screen on the Slider gifLogo = Loader animation displayed during Registration


Logo config implementation Android:
 
Data Class:

data class LogoConfig(
    var defaultLogo: Int? = null,
    var roundedLogo: Int? = null,
    var gifLogo: Int? = null
)
 
 
Sample Code
val logoConfig = LogoConfig(
    defaultLogo = R.drawable.ic_android_logo,
    roundedLogo = R.drawable.ic_android_logo,
    gifLogo = R.drawable.ic_android_logo_animated
)
 

10. Callback Success/Error Codes

The table lists possible callback success and error codes, and their reasons:

CodeReason
303Biometric is disabled. Please enable the same to register for biometric authentication
305Device deregistered as unable to fetch records.
308Invalid parameters provided. Please check your input and try again.
310SDK timed out. Please try again
311Unable to initialize SDK. Please try again later
331Device Debugging detected. For security, please disable to proceed.
332Device security check failed. Please try from a more secure device
333Device Rooting detected (JailBreak), Can't Proceed.
361No network connection available. Please check your internet connection and try again
367Device is in airplane mode. Please turn off airplane mode and try again
368Something went wrong. Please try again later.
390Please Insert SIM and try again
391Required permissions not granted. Please allow access in settings and try again.
392Configuration Successful