Android SDK Documentation

Android SDK Version 2.15

Updates in new version

  • Better user experience
  • Improved Results

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.15")
    implementation("com.github.yazanalqasem:iPass2.0CoreAndroidSDK:2.15")
    
  • 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/Beta")
        }
    }
}

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" />

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_AUTH, 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 two types of databases. Currently this database only allows to scan Jordanian ID cards as well as passports from other countries.
    1. DatabaseType.BASIC
    2. DatabaseType.FULL_AUTH

Basic Database:

The basic database option provides a streamlined version of the database, focusing on essential data without incorporating any authenticity parameters. This option is suitable if your application does not require advanced security features and you want faster access to core data.

fullAuth database:

The fullAuth database option is designed for applications that need enhanced security and authenticity features. This version includes additional parameters that ensure the authenticity of the document, making it ideal for scenarios where data integrity and security are critical.

Dynamic Database Implementation:

DataBaseDownloading.initializeDynamicDb(context = this, 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.

For more accurate results, you can enable the 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.15")
    

    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.