Android SDK Documentation

Android SDK Version 2.16

Updates in new version

  • Includes a ready-to-use database file for easier deployment and integration.
  • Now supports on-premise deployments, providing greater control and security.
  • Improved interface and performance for a more seamless and intuitive experience.

Migration Guide

  • To upgrade from earlier iPass versions to version 2.16, follow these steps...

    • Modify the settings.gradle file by replacing it with the following code snippet:

          dependencyResolutionManagement {
              repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
              repositories {
                  google()
                  mavenCentral()
                  maven {
                      url = uri("https://jitpack.io")
                  }
                  maven {
                      url =uri("https://maven.regulaforensics.com/RegulaDocumentReader")
                  }
              }
          }
      
    • Update the dependency versions in the build.gradle file as follows:

      implementation("com.github.yazanalqasem:iPass2.0NativeAndroidSDK:2.16")
      implementation("com.github.yazanalqasem:iPass2.0CoreAndroidSDK:2.16")
      
    • If you are using the pre-packaged database implementation, please use the database from the available databases.

Steps of using iPass SDK

To explain how a user can use the iPass SDK framework in steps, you can outline the process as follows:

Steps to use iPass SDK

Integration of SDK into App

  • In this step User Will add the IPass SDK inside the app's gradle file:

    implementation("com.github.yazanalqasem:iPass2.0NativeAndroidSDK:2.16")
    implementation("com.github.yazanalqasem:iPass2.0CoreAndroidSDK:2.16")
    
  • Add these lines in your settings.gradle file

        dependencyResolutionManagement {
            repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
            repositories {
                google()
                mavenCentral()
                maven {
                    url = uri("https://jitpack.io")
                }
                maven {
                    url =uri("https://maven.regulaforensics.com/RegulaDocumentReader")
                }
            }
        }
        
  • Add this snippet to build. gradle file in your project.

        android {
            compileOptions {
                isCoreLibraryDesugaringEnabled = true
            }
        }
    

Configure Permissions in manifest file

In this step user will give required permissions in manifest file to enable the necessary device features:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-permission android:name="android.permission.NFC" />

  • iPass supports On-Prem server integration. To use an on-prem server, provide the server URL in the serverUrl parameter.

    • If serverUrl is an empty string, the data will be saved on the iPass server.
    • If serverUrl contains a valid URL, the data will be saved on your on-prem server.
  • To start the process user need to download the database. iPass sdk supports two type of database systems.

    • Pre-packaged Database
    • Dynamic Database

Pre-packaged Database:

This type of database is bundled within the SDK itself. It is a pre-configured and read-only database that comes as part of the app's installation package. Since the database is local to the app, querying this database is generally faster, as it does not involve network latency. This is a custom database designed to meet specific requirements. If you need a custom database tailored to your needs, you can request one by contacting our support team at info@ipass-mena.com.

Dynamic Database:

This type of database is not included in the initial app package but is instead downloaded from a remote server when the app is launched or when certain conditions are met. The server-side database can be updated independently of the app, allowing for more dynamic content and real-time data management. In this database downloading time depends on the internet speed.

Pre-packaged Database Implementation:

DataBaseDownloading.initializePreProcessedDb(context = this, dbName = DatabaseType.FULL_DB, serverUrl = "http://192.168.19.421/", completion = object: InitializeDatabaseCompletion {
    override fun onProgressChanged(progress: Int) {
        //get progress
    }

    override fun onCompleted(
        status: Boolean,
        message: String?
    ) {
        if (status) {
    //proceed to next step
}
    }

})
  • In the onCompleted method, when the status returns true, you can start the next step.
  • In the Pre-packaged Database, system allows you to choose between three types of databases.
    1. DatabaseType.BASIC_JORDAN
      • This database stores all types of documents for Jordan but only passports for other countries. It does not include authentication checks.
    2. DatabaseType.FULL_AUTH_JORDAN
      • This database stores all types of documents for Jordan but only passports for other countries. It also includes authentication checks.
    3. DatabaseType.FULL_DB
      • This database stores all types of documents for all countries. It does not include authentication checks.
  • If there is any error in the process it will return the status false and error message in error(String).
  • Replace http://192.168.19.421/ with your actual on-prem server URL if applicable.

Dynamic Database Implementation:

DataBaseDownloading.initializeDynamicDb(context = this, serverUrl = "http://192.168.19.421/", completion = object: InitializeDatabaseCompletion {
    override fun onProgressChanged(progress: Int) {
//get progress
    }

    override fun onCompleted(
        status: Boolean,
        message: String?
    ) {
        if (status) {
    //proceed to next step
}
    }

})
  • Override function onProgressChanged can be used to track the downloading percentage.
  • Once the database is downloaded 100% and status returns true in onCompleed method, user can start the next step.
  • If there is any error in the process it will return the status false and error message in error(String).
  • Replace http://192.168.19.421/ with your actual on-prem server URL if applicable.

For authentication checks, you need to enable hologram option using the following code snippet. By default, this option is disabled:

configProperties.needHologramDetection(value = true)

  • Pass valid email id and password to get user token

Code for user login

    iPassSDKManger.UserOnboardingProcess(context = this, email, password, object :
    ResultListener<AuthenticationResponse> {
    override fun onSuccess(response: AuthenticationResponse?) {
        val userToken = response?.user?.token!!
    }

    override fun onError(exception: String) {
// error message
    }
})
  • Once the user is logged in userToken need to save because this will be used in document scanning process

    val getList:  Array<HashMap<:String, String>> = iPassSDKManger.getWorkFlows()
  • In the getList object you will get the array of Hashmaps with all the flows
  • Get the flowId from the list of supported flows which will be required for scanning process
  • Sdk Supported Flows

    • Full Processing(10031)
    • Id verification + Liveness + AML(10032)
    • Id verification + AML(10015)
    • Id verification + Liveness(10011)
  • In Full Process(10031), Social media email and phone number is required

  • User can scan various types of documents.
  • Users can scan both the front and back sides of documents, but it totally depends on the document type.

Code to scan document

iPassSDKManger.startScanningProcess(
    requireContext(),
    email,
    userToken,
    apptoken,
    socialMediaEmail,
    phoneNumber,
    workflowId,
    binding.root as ViewGroup) {
        status, message ->
    if (status) {
        getDocData(model.workflow)
    } else {
        Log.e("startScanningProcess", message)
        Toast.makeText(context,message,Toast.LENGTH_SHORT).show()
    }
}
  • userToken will be the login token
  • appToken will be the auth token provided by Admin
  • workflowId will be the id selected by the user from above step.
  • After the scanning process, Response can be obtained using getDocumentScannerData method.

iPassSDKManger.getDocumentScannerData(requireContext(), apptoken, object :
ResultListener<TransactionDetailResponse> {
override fun onSuccess(response: TransactionDetailResponse?) {
    if (response?.Apistatus!!) {
        val data = response.data!!
    }
}

override fun onError(exception: String) {
    Toast.makeText(context, exception, Toast.LENGTH_SHORT).show()
}
}) 
  • "data" variable will return the required json response
  • "onError" method will return the error description

Enable Hologram Detection

    configProperties.needHologramDetection(true)

Disable Hologram Detection

    configProperties.needHologramDetection(false)

SDK will support these languages, Once language will change from android device settings or app language is changed

  • English
  • Arabic
  • German
  • French
  • Spanish
  • Kurdish
  • Turkish
  • Urdu

To reduce the APK size, follow these steps:

  1. In android studio, Select File > New > New Module from the menu bar. In the Create New Module dialog, select Dynamic Feature Module and click Next.
  2. On the Configure your new module screen, give your module a name(iPassSdk).
  3. On the Configure your new module screen, specify the module title(iPass).
  4. Check the Enable on-demand box. Hit Finish and wait for the project to sync.
  5. Now add the below mentioned line in the dynamic module's (iPassSdk) build gradle file and sync project.

    implementation("com.github.yazanalqasem:iPass2.0CoreAndroidSDK:2.16")
    

    Note : Remove this line from app's build gradle file

  6. Add these lines in your activity

        private var splitInstallManager: SplitInstallManager? = null
        splitInstallManager = SplitInstallManagerFactory.create(this)
        val request = SplitInstallRequest.newBuilder()
        .addModule(name)
        .build()
        splitInstallManager?.startInstall(request)
        ?.addOnSuccessListener {
        // Packages Installed (Initialise Database Here)
        }
        ?.addOnFailureListener {
        // Packages Installation failed!
        }
    

Configuring Webhook URL in Your iPass Account

Your iPass account can be set up to send an HTTP POST request with JSON data to a specified URL upon the completion of an onboarding process. This URL can be configured in the account profile section of the iPass web application.

Steps to Configure the Webhook URL:

  • Log in to your iPass dashboard.
  • Navigate to the "My Profile" section
  • Click the "Edit" button, enter your webhook URL in the designated field, and click "Update." Your webhook URL will now be added.

We also provide the webhook signature verification here are the instructions to generate the signature in the node js.

const generateSignature = (uid, secret) => { return crypto.createHmac('sha256', secret) .update(JSON.stringify(uid)) .digest('hex'); };
const uid = { uid(uid that will sent you on webhook eg:ad962a61-6dcb-49cd-a863-353b1a5342cc) };
const secretKey = 'secret-key which we share you securely';
const signature = generateSignature(uid, secretKey);

From our side you can get the signature in the headers of webhook.