Android SDK Integration Guide

Welcome to the Android SDK integration guide. Follow these steps to seamlessly integrate our Digital Identity solution through our Android SDK for secure and efficient validation of your users by identity flows.

Prerequisites

  1. Account Creation: In order to perform an integration in any of our services, you must have a Truora account. Your Truora sales representative will provide you with one, or you can create one for free.

  2. Create a Truora API Key: In order to perform an integration in any of our services, you must have a Truora API key. Follow this guide to create your Truora API key.

  3. Create a Digital Identity Web Flow: For instructions on how to create a Web Flow, please refer to the Digital Identity Verification Flow guide.

  4. Create a Web Integration Token: For instructions on how to generate a token, please refer to the How to create a Web Integration Token guide.


Android SDK Documentation

Usage

To use the Android SDK, you will need the following inputs:

  • Token: Web Integration Token generated in Prerequisite 4.

Requirements

  • Java: >= 1.8

Installation

The SDK is available for installation via Maven Central Repository.

Example in Kotlin

TruoraSampleApp

import android.app.Activity
import android.content.Intent
import android.os.Bundle
import android.widget.Toast
import androidx.activity.ComponentActivity
import androidx.activity.result.contract.ActivityResultContracts
import com.truora.truorasdk.LoadFrontendInput
import com.truora.truorasdk.TruoraActivity

class MainActivity : ComponentActivity() {

    private val startTruoraForResult = registerForActivityResult(
        ActivityResultContracts.StartActivityForResult()
    ) { result ->
        if (result.resultCode == Activity.RESULT_OK && result.data != null) {
            val message = "Verification successful!"
            Toast.makeText(
                this,
                message,
                Toast.LENGTH_SHORT
            ).show()
        } else {
            val message = "Verification canceled or failed."
            Toast.makeText(
                this,
                message,
                Toast.LENGTH_SHORT
            ).show()
        }
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        // Replace "YOUR_TOKEN" with your actual token
        val token = "YOUR_TOKEN"
        val loadFrontendInput = LoadFrontendInput(token)

        // Initialize TruoraActivity
        val intent = Intent(this, TruoraActivity::class.java)
        intent.putExtra("diInput", loadFrontendInput)

        // Start TruoraActivity using registerForActivityResult
        startTruoraForResult.launch(intent)
    }
}

With this setup, you can now test the Digital Identity (DI) feature in a Kotlin app! 😃