Biometrics SDK Integration Guide

A touchless fingerprint biometric capture SDK for Android that uses AI-powered hand detection to capture and process fingerprint images.

  • Home
  • Biometrics SDK Integration Guide

Requirements

RequirementVersion
Android SDK24+ (Android 7.0 Nougat)
Kotlin1.7.10+
CameraRequired
NetworkRequired for processing

Installation

Step 1: Add JitPack Repository

Add the JitPack repository to your project's settings.gradle (or settings.gradle.kts):

Groovy (settings.gradle):

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        maven {
            url = uri("https://jitpack.io")
            credentials {
                username = "YOUR_JITPACK_TOKEN"
                password = ""
            }
        }
    }
}

Kotlin DSL (settings.gradle.kts):

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        maven {
            url = uri("https://jitpack.io")
            credentials {
                username = "YOUR_JITPACK_TOKEN"
                password = ""
            }
        }
    }
}

Note: Replace YOUR_JITPACK_TOKEN with the token provided by the SDK vendor.

Step 2: Add Dependency

Add the SDK dependency to your app's build.gradle:

Groovy:

dependencies {
    implementation 'com.github.RMS-Techknowledgy-Private-Limited:biometrics-sdk:1.0.3'
}

Kotlin DSL:

dependencies {
    implementation("com.github.RMS-Techknowledgy-Private-Limited:biometrics-sdk:1.0.3")
}

Step 3: Sync Project

Sync your Gradle files to download the SDK.

Quick Start

Basic Integration

import com.biometrics.Biometrics
import com.biometrics.model.BiometricsResult

class MainActivity : AppCompatActivity() {

    // Register the SDK launcher
    private val biometricsLauncher = Biometrics.register(this) { result ->
        handleResult(result)
    }

    private fun handleResult(result: BiometricsResult) {
        when (result) {
            is BiometricsResult.Success -> {
                // Fingerprints captured successfully
                val batchId = result.batchId
                val files = result.processedFiles

                files.forEach { file ->
                    Log.d("Biometrics", "Finger: ${file.original_name}")
                    Log.d("Biometrics", "PNG URL: ${file.processed_png}")
                    Log.d("Biometrics", "WSQ URL: ${file.processed_wsq}")
                }
            }
            is BiometricsResult.Error -> {
                // Handle error
                Log.e("Biometrics", "Error: ${result.message}")
            }
            is BiometricsResult.Cancelled -> {
                // User cancelled the capture
                Log.d("Biometrics", "Capture cancelled by user")
            }
        }
    }

    fun startFingerprintCapture() {
        // Launch with your authentication token
        biometricsLauncher.launch("your-auth-token")
    }
}

Fragment Integration

import com.biometrics.Biometrics
import com.biometrics.model.BiometricsResult

class MyFragment : Fragment() {

    private val biometricsLauncher = Biometrics.register(this) { result ->
        when (result) {
            is BiometricsResult.Success -> handleSuccess(result)
            is BiometricsResult.Error -> handleError(result)
            is BiometricsResult.Cancelled -> handleCancelled()
        }
    }

    fun captureBiometrics(token: String) {
        biometricsLauncher.launch(token)
    }
}

API Reference

Biometrics

The main entry point for the SDK.

object Biometrics {
    /**
     * Register the SDK with an Activity
     * @param activity The host ComponentActivity
     * @param onResult Callback for capture results
     * @return BiometricsLauncher instance
     */
    fun register(
        activity: ComponentActivity,
        onResult: (BiometricsResult) -> Unit
    ): BiometricsLauncher

    /**
     * Register the SDK with a Fragment
     * @param fragment The host Fragment
     * @param onResult Callback for capture results
     * @return BiometricsLauncher instance
     */
    fun register(
        fragment: Fragment,
        onResult: (BiometricsResult) -> Unit
    ): BiometricsLauncher
}

BiometricsLauncher

Controls the biometrics capture flow.

class BiometricsLauncher {
    /**
     * Launch the fingerprint capture flow
     * @param token Authentication token for API access
     */
    fun launch(token: String)
}

Result Handling

BiometricsResult

A sealed class representing the capture outcome.

sealed class BiometricsResult {
    /**
     * Capture completed successfully
     */
    data class Success(
        val batchId: String,                    // Unique batch identifier
        val processedFiles: List<ProcessedFile>, // Captured fingerprints
        val parameters: ProcessingParams?        // Processing settings used
    ) : BiometricsResult()

    /**
     * An error occurred during capture
     */
    data class Error(
        val message: String  // Error description
    ) : BiometricsResult()

    /**
     * User cancelled the capture
     */
    object Cancelled : BiometricsResult()
}

ProcessedFile

Details of a processed fingerprint file.

data class ProcessedFile(
    val original_name: String,   // e.g., "RIGHT_INDEX.png"
    val captured_png: String?,   // Original captured image URL (if available)
    val processed_png: String,   // Processed PNG image URL
    val processed_wsq: String    // Processed WSQ file URL (FBI standard)
)

ProcessingParams

Processing parameters used for the capture.

data class ProcessingParams(
    val thickness: Int = 2,      // Ridge thickness (1=thin, 2=medium, 3=thick)
    val margin: Int = 20,        // Edge mask margin in pixels
    val crop: Boolean = true,    // Auto-crop to fingerprint region
    val dpi: Int = 500,          // Output resolution
    val block_size: Int = 16     // Processing block size
)

Supported Fingerprint Types

The SDK captures 4 fingers from the right hand:

Finger
RIGHT_INDEX
RIGHT_MIDDLE
RIGHT_RING
RIGHT_LITTLE

Permissions

The SDK requires the following permissions. Add them to your AndroidManifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android">

    <!-- Required Permissions -->
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.INTERNET" />

    <!-- Required Features -->
    <uses-feature android:name="android.hardware.camera" android:required="true" />

</manifest>

Note: The SDK handles runtime camera permission requests internally.

Complete Example

package com.example.myapp

import android.os.Bundle
import android.widget.Button
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import com.biometrics.Biometrics
import com.biometrics.model.BiometricsResult

class MainActivity : AppCompatActivity() {

    private val biometricsLauncher = Biometrics.register(this) { result ->
        when (result) {
            is BiometricsResult.Success -> {
                Toast.makeText(
                    this,
                    "Captured ${result.processedFiles.size} fingerprints",
                    Toast.LENGTH_SHORT
                ).show()

                // Process the results
                result.processedFiles.forEach { file ->
                    println("Finger: ${file.original_name}")
                    println("PNG: ${file.processed_png}")
                    println("WSQ: ${file.processed_wsq}")
                }
            }

            is BiometricsResult.Error -> {
                Toast.makeText(
                    this,
                    "Error: ${result.message}",
                    Toast.LENGTH_LONG
                ).show()
            }

            is BiometricsResult.Cancelled -> {
                Toast.makeText(
                    this,
                    "Capture cancelled",
                    Toast.LENGTH_SHORT
                ).show()
            }
        }
    }

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

        findViewById<Button>(R.id.captureButton).setOnClickListener {
            startCapture()
        }
    }

    private fun startCapture() {
        val authToken = getAuthToken() // Your authentication logic
        biometricsLauncher.launch(authToken)
    }

    private fun getAuthToken(): String {
        // Implement your token retrieval logic
        return "your-auth-token"
    }
}

Troubleshooting

Common Issues

IssueSolution
Token verification failedVerify your authentication token is valid and not expired
Camera permission deniedEnsure camera permission is granted; the SDK will request it
Network errorCheck internet connectivity and server availability
No hand detectedEnsure adequate lighting and position hand properly in frame
Low quality captureImprove lighting conditions and hold hand steady

Build Errors

If you encounter dependency conflicts, try adding the following to your build.gradle:

android {
    packagingOptions {
        pickFirst 'META-INF/DEPENDENCIES'
        pickFirst 'META-INF/LICENSE'
        pickFirst 'META-INF/LICENSE.txt'
    }
}

Output Formats

PNG Format

  • Lossless image format
  • Suitable for display and general processing
  • Resolution: 500 DPI (default)

WSQ Format

  • FBI Wavelet Scalar Quantization standard
  • Industry-standard format for fingerprint storage
  • Compatible with AFIS systems
  • Compression optimized for fingerprint ridge patterns

Support

For technical support or to obtain an authentication token, contact the SDK provider.

Stable Release

VersionNotes
1.0.3Initial release