V1 Application SDK Integration Guide
This document outlines the steps required for integrating the V1 Application as an SDK within a third-party mobile application.
1. SDK Installation on Mobile Devices
The third-party application must ensure that the V1 Application is installed on the user’s device. This installation should be performed directly by the third-party application through its distribution mechanism or prompt the user to install the V1 Application if it is not already available.
Reference - Install Application programmatically on Android - Umesh Thapa
2. Verify V1 Application Presence
Before proceeding with further integration steps, the third-party application should programmatically check whether the V1 Application is installed on the device.
-
If the application is present: Continue with the subsequent integration steps.
-
If not: install the V1 Application before proceeding.
Reference - How to check programmatically if an application is installed or not in Android? - Stack Overflow
3. Generate SSO Token
The third-party application must obtain a Single Sign-On (SSO) token by invoking the GENERATESSOTOKEN service.
- The API endpoint for this service will be provided by the backend team.
- Upon a successful token generation, the application can proceed to the next step.
- If the token generation fails, the application should implement a retry mechanism by invoking the same endpoint again until a valid token is obtained.
4. Launch the V1 Application
After successfully generating the SSO token, the third-party application must launch the V1 Application using the application’s package name by starting an activity and passing the following parameters:
-
loginId: The user’s unique identifier (User ID/Username).
-
token: The SSO token obtained from the GENERATESSOTOKEN service.
This will initiate the intended workflow within the V1 Application using the provided credentials.
Sample Implementation (Reference Only)
fun openV1Application(context: Context, loginId: String, token: String) {
val packageName = “dataon.decimal.application”
// Check if the application is installed
val packageManager = context.packageManager
val launchIntent = packageManager.getLaunchIntentForPackage(packageName)
if (launchIntent != null) {
// Pass the required parameters
launchIntent.putExtra(“loginId”, loginId)
launchIntent.putExtra(“token”, token)
// Start the activity
context.startActivity(launchIntent)
} else {
// App not installed – redirect to Play Store or show message
Toast.makeText(context, “V1 Application not installed.”, Toast.LENGTH_LONG).show()
}
}