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.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.23'
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)'
}
}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:
-
Push Notification
-
Push with Biometric
-
Offline OTP
Permission | Description | Mandatory for Modes |
|---|---|---|
Post notification | Mandatory for version13 and above to receive push notification |
|
Phone State | Mandatory to detect sim swap scenarios |
|
SMS | For auto send of SMS if SDK is enabled for binding the device |
|
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
| Application Context | All |
clientId
| Will be shared offline | All |
env
| Default - UAT. For production, to be passed as "PROD" | All |
themeConfig | 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) // UAT or PROD
jsonObject.put("simIndex", 0)
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
| Application Context |
fcmToken
| 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
| Instance of AppCompatActivity |
mobileNumber
| Mobile number of the user prefixed with country code |
cif
| 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
| Application Context |
clientId
| Client ID |
mobileNumber
| Mobile number of the user against which the card is registered prefixed with country code |
cif
| 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
| Context of the transaction. | All |
remoteMessage | Message received from push notification |
|
buildNotification | Default value: False |
|
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
| Instance of AppCompatActivity |
limit
| Number of transaction records fetched per single request. Default is 10 records per request. |
offset
| 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 |
|---|---|---|
LabelCustomizationoptional |
Configurations: HeaderCustomization,TextCustomization. Sub Components: textColor, fontSize | labelConfigObject |
ToolbarCustomizationoptional |
Configurations: backgroundColor, textColor, fontSize | toolbarConfigObject |
ButtonCustomizationoptional |
Configurations: primaryButtonCustomization, secondaryButtonCustomization. Sub Components: enabledBackgroundColor, enabledTextColor, disabledBackgroundColor, disabledTextColor, fontSize, cornerRadius | buttonConfigObject |
Text Customization Parameters
| Parameter | Description | Example |
|---|---|---|
| bottomSheet PermissionPopup Configuration optional | Text customization for permission popup: topHeaderText,topSubHeaderText, headerTextForContents, subTextForContents, buttonTextForAllowPermissions, buttonTextForSkipPermissions | permissionPopupConfig |
| bottomSheet SimBindingProcessing PopupConfiguration optional | Texts for SIM binding, number verification, biometric setup, etc. topHeaderText, topSubHeaderText, headerTextForContents, subTextForContents, numberVerificationProcessingText, numberVerifiedText, biometricSetupText, biometricVerifiedText, processingCircleColor | simBindingConfig |
| bottomSheet RegistrationSuccessful PopupConfiguration optional | Success messages and buttonText topHeaderText, topSubHeaderText, headerTextForContents, subTextForContents, buttonText, buttonColor | registrationSuccessConfig |
| bottomSheet FailureScreen Configuration optional | Error messages and buttonText topHeaderText, topSubHeaderText, headerTextForContents, subTextForContents, buttonText, buttonColor | failureScreenConfig |
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)
Updated about 7 hours ago