IDV Android Fingers library

v9.5.0

Introduction

IDV Android Fingers provides components for fingers capture and related functionalities which are easy to integrate into an Android application.

Requirements

IDV Android Fingers has the following requirements:

  • Minimum Android API level 24

  • Minimum Kotlin Gradle plugin version 1.6.0 (if used)

Distribution

Modularization

IDV Android Fingers is divided into core module and optional feature modules. This enables you to reduce the size of the library and include only modules that are actually used in your use case.

IDV Android Fingers is divided into following modules:

  • dot-fingers-core (Required) - provides API for all the features and functionalities.

  • dot-fingers-detection (Optional) - enables the fingers detection feature.

  • dot-fingers-transformation (Optional) - enables fingers transformation to fingerprints feature.

Each feature module can have other modules as their dependency and cannot be used without it, see the table below.

Table 1. Module dependencies

Module

Dependency

dot-fingers-detection

dot-fingers-core

dot-fingers-transformation

dot-fingers-core

Maven Repository

IDV Android Fingers is distributed as a set of Android libraries (.aar packages) stored in the Innovatrics maven repository. Each library represents a single module.

In order to integrate IDV Android Fingers into your project, the first step is to include the Innovatrics maven repository to your settings.gradle.kts file.

settings.gradle.kts
dependencyResolutionManagement {
    repositories {
        maven {
            url = URI("https://maven.innovatrics.com/releases")
        }
    }
}

Then, specify the dependencies of IDV Android Fingers libraries in the build.gradle.kts file. Dependencies of these libraries will be downloaded alongside them.

build.gradle.kts
dependencies {
    implementation("com.innovatrics.dot:dot-fingers-detection:$dotVersion")
    implementation("com.innovatrics.dot:dot-fingers-transformation:$dotVersion")
}

In order to optimize application size, we also recommend adding the following excludes to your application’s build.gradle.kts file.

build.gradle.kts
android {
    packaging {
        resources {
            excludes += listOf(
                "**/jnidispatch.dll",
                "**/libjnidispatch.a",
                "**/libjnidispatch.jnilib",
                "**/*.proto",
            )
        }
    }
}

Supported Architectures

IDV Android Fingers provides binaries for these architectures:

  • armeabi-v7a

  • arm64-v8a

  • x86

  • x86_64

If your target application format is APK and not Android App Bundle, and the APK splits are not specified, the generated APK file will contain binaries for all available architectures. Therefore we recommend to use APK splits. For example, to generate arm64-v8a APK, add the following section into your module build.gradle.kts:

build.gradle.kts
splits {
    abi {
        isEnable = true
        reset()
        include("arm64-v8a")
        isUniversalApk = false
    }
}

If you do not specify this section, the resulting application can become too large in size.

Licensing

In order to use IDV SDK in other apps, it must be licensed. The license can be compiled into the application as it is bound to the application ID specified in build.gradle.kts:

build.gradle.kts
android {
    defaultConfig {
        applicationId = "com.innovatrics.dot.samples"
    }
}

The application ID can be also retrieved in runtime by calling DotSdk.getApplicationId().

In order to obtain the license, please contact your Innovatrics’ representative specifying the application ID. If the application uses build flavors with different application IDs, each flavor must contain a separate license. Put the license file into the raw resource folder.

Permissions

IDV Android Fingers declares the following permission in AndroidManifest.xml:

AndroidManifest.xml
<uses-permission android:name="android.permission.CAMERA" />

Basic Setup

Initialization

Before using any of the components, you need to initialize IDV SDK with the license and DotFingersLibraryConfiguration object with feature modules you want to use. Each feature module can be activated by a *ModuleConfiguration class. See the table below.

Table 2. IDV Android Fingers feature modules

Feature module

Class

dot-fingers-detection

DotFingersDetectionModuleConfiguration

dot-fingers-transformation

DotFingersTransformationModuleConfiguration

InitializeDotSdkUseCase class in the Samples project shows how to initialize IDV SDK with DotFingersLibraryConfiguration and all feature modules. DotSdk.initialize() method should be called on background thread.

Keep in mind that if you try to use any component without initialization or any feature which was not added during initialization, it will throw an exception. Also be aware that while the app is in background, the system may kill the process to free resources. In such a case, you need to reinitialize the SDK when the app is brought back to the foreground. We recommend to check the SDK initialization status (using DotSdk.isInitialized() method) in your Fragment’s onViewCreated(). This technique is implemented in the Samples project.

Deinitialization

When a process (e.g. onboarding) using the IDV Android Fingers has been completed, it is usually a good practice to free the resources used by it.

You can perform this by calling DotSdk.deinitialize(). If you want to use the IDV Android Fingers components again after that point, you need to call DotSdk.initialize() again. This shouldn’t be performed within the lifecycle of individual Android components.

Components

Overview

IDV Android Fingers provides both non-UI and UI components. Non-UI components are aimed to be used by developers who want to build their own UI using the IDV Android Fingers functionality. UI components are build on top of non-UI components. These are available as abstract fragments and can be extended and then embedded into the application’s existing activity providing more control.

List of Non-UI Components

FINGER DETECTOR

A component for performing finger detection on an image.

FINGERS AUTO CAPTURE CONTROLLER

A component for capturing good quality images of human fingers.

FINGER TO FINGERPRINT TRANSFORMER

A component for transforming finger images to fingerprint images.

List of UI Components

UI FINGERS AUTO CAPTURE

A visual component for capturing good quality images of a human fingers.

Non-UI Components

Finger Detector

The FingerDetector interface provides a finger detection functionality.

Create a FingerDetector:

val fingerDetector = FingerDetectorFactory.create()

To perform detection, call the following method on the background thread:

val fingers = fingerDetector.detect(image = image, limit = 4)

Fingers Auto Capture Controller

The FingersAutoCaptureController interface provides a stateful fingers auto capture functionality.

Create FingersAutoCaptureController:

val configuration = FingersAutoCaptureController.Configuration(
    context = context,
    validators = validators,
    //…
)
val fingersAutoCaptureController = FingersAutoCaptureControllerFactory.create(configuration)

You can use detectionArea to specify the region in the input image which will be used for finger detection. For example, if you want to ignore top 30% and bottom 30% of the input image, you can do it as follows:

val configuration = FingersAutoCaptureController.Configuration(
    context = context,
    validators = validators,
    detectionArea = RectangleDouble(
        left = 0.0,
        top = 0.3,
        right = 1.0,
        bottom = 0.7,
    ),
    //…
)

If detectionArea is not specified, the source input image is used for finger detection.

To capture a good quality finger image, repeatedly call the process() method using the samples:

val sample = Sample(timestampMillis, image)
val processingResult = fingersAutoCaptureController.process(sample)

The controller evaluates the image requirements for each sample (frame), tracking every finger (index, middle, ring and little) independently. The behaviour is configured via the autoCapture property of the configuration (an AutoCaptureConfiguration instance). Candidate selection starts independently for each finger: once a finger has minValidSamplesInRowToStartCandidateSelection valid samples in a row, the controller keeps its best image and keeps updating it as better frames arrive. Because each finger is selected on its own schedule, different fingers may be captured from different frames. Once at least minFingerCount fingers are in candidate selection, the process finishes after candidateSelectionDurationMillis milliseconds, returning the best image of each finger.

Finger to Fingerprint Transformer

The FingerToFingerprintTransformer interface provides a functionality for transforming finger images to fingerprint images.

Create a FingerToFingerprintTransformer:

val fingerToFingerprintTransformer = FingerToFingerprintTransformerFactory.create()

To perform the transformation, call the following method on the background thread:

val fingerprintImage = fingerToFingerprintTransformer.transform(fingerBundle = fingerBundle)

Or for multiple finger images:

val fingerprintImages = fingerToFingerprintTransformer.transform(fingerBundles)

UI Components

Fragment Configuration

Components containing UI are embedded into the application as fragments from Android Support Library. All fragments are abstract. They must be subclassed and override their abstract methods.

Fragments requiring runtime interaction provide public methods, for example start().

class DemoFingersAutoCaptureFragment : FingersAutoCaptureFragment() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        start()
    }

    //…
}

The FingersAutoCaptureFragment requires a configuration. To provide configuration data, you should override the provideConfiguration() method in your subclass implementation. This method should return an instance of the FingersAutoCaptureFragment.Configuration data class with the desired parameters.

class DemoFingersAutoCaptureFragment : FingersAutoCaptureFragment() {

    override fun provideConfiguration(): Configuration {
        return Configuration(
            base = BaseFingersAutoCaptureFragment.Configuration(
                camera = CameraConfiguration(
                    facing = CameraFacing.BACK,
                    previewScaleType = CameraPreviewScaleType.FIT,
                    //…
                ),
                //…
            ),
            //…
        )
    }

    //…
}

Camera permission

A fragment (UI component) will check the camera permission (Manifest.permission.CAMERA) right before the camera is started. If the camera permission is granted the fragment will start the camera. If the camera permission is not granted the fragment will use Android API - ActivityResultContracts.RequestPermission to request the camera permission. Android OS will present the system dialog to the user of the app. If the user explicitly denies the permission at this point, onNoCameraPermission() callback is called. Implement this callback in order to navigate the user further in your app workflow.

Orientation Change

In order to handle the orientation change in multi-window mode correctly, configure the activity in your AndroidManifest.xml file as follows:

<activity
    android:name=".MyActivity"
    android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" />

Video Recording for Identity Proofing

UI components support video recording. You can enable this feature in the component’s configuration using the base.camera.isVideoCaptureEnabled property. The duration of the captured video is limited to a maximum of 8 seconds, corresponding to the end of the processing session. The captured video is bundled into the component’s result binary content and can be retrieved via the Digital Identity Service (DIS) for the purposes of Identity proofing.

UI Fingers Auto Capture

The fragment with instructions for obtaining quality finger images suitable for further processing.

In order to configure the behaviour of FingersAutoCaptureFragment, use FingersAutoCaptureFragment.Configuration (see Fragment Configuration).

To use the fragment, create a subclass of FingersAutoCaptureFragment and override appropriate callbacks.

To start the process call the start() method. You can start the process any time.

In case you want to handle detection data, implement onUiStateUpdated() callback. This callback is called with each processed camera frame. When the process finishes successfully, the result will be returned via the onFinished() callback.

In case you want to force the capture event, call the requestCapture() method. The most recent image will be returned via the onFinished() callback asynchronously.

Call start() method again in case you need to start over the process. You can also call start() method to stop and start over ongoing process as well.

In case you want to stop the process prematurely, call the stop() method.

Quality Attributes of the Output Image

You may adjust quality requirements for the output image. To perform this, you can use pre-defined instances - QualityAttributeThresholds - from QualityAttributeThresholds.Presets with recommended thresholds and pass it to BaseFingersAutoCaptureFragment.Configuration by setting the qualityAttributeThresholds. You can also create your own instance of QualityAttributeThresholds from scratch or based on pre-defined instances according to your needs.

Possible ways how to create QualityAttributeThresholds:

// The standard preset
val standard = QualityAttributeThresholds.Presets.standard

// Modified thresholds based on the standard preset
val modified = standard.copy(
    minConfidence = minConfidence,
    fingers = standard.fingers.copy(
        index = standard.fingers.index.copy(minSharpness = null),
    ),
)

// Custom thresholds
val custom = QualityAttributeThresholds(
    minConfidence = minConfidence,
    fingers = QualityAttributeThresholds.Fingers(
        index = QualityAttributeThresholds.Finger(minSharpness = minSharpness),
    ),
)

Available presets (pre-defined instances with thresholds) in QualityAttributeThresholds.Presets:

  • standard - The resulting image suitable for evaluation on Digital Identity Service. See the thresholds.

Customization of UI components

Strings

You can override the string resources in your application and provide alternative strings for supported languages using the standard Android localization mechanism.

<string name="dot_fingers_fingers_auto_capture_instruction_candidate_selection">Stay still…</string>
<string name="dot_fingers_fingers_auto_capture_instruction_finger_count_not_four">Show four fingers</string>
<string name="dot_fingers_fingers_auto_capture_instruction_finger_count_too_low">Show more fingers</string>
<string name="dot_fingers_fingers_auto_capture_instruction_fingers_not_detected">Position your fingers into the placeholder</string>
<string name="dot_fingers_fingers_auto_capture_instruction_fingers_out_of_bounds">Center fingers</string>
<string name="dot_fingers_fingers_auto_capture_instruction_sharpness_too_low">More light needed</string>
<string name="dot_fingers_fingers_auto_capture_instruction_size_too_large">Move back</string>
<string name="dot_fingers_fingers_auto_capture_instruction_size_too_small">Move closer</string>
Colors

You may customize the colors used by IDV Android Fingers in your application. To use custom colors, override the specific color.

<color name="dot_detection_layer">#ffffffff</color>
<color name="dot_instruction_background">#fff8fbfb</color>
<color name="dot_instruction_candidate_selection_background">#ff00bfb2</color>
<color name="dot_instruction_candidate_selection_text">#ff131313</color>
<color name="dot_instruction_text">#ff131313</color>
<color name="dot_placeholder">#ffffffff</color>
<color name="dot_placeholder_candidate_selection">#ff00bfb2</color>
Styles

Text views and buttons can be styled by overriding the parent style in the application.

<style name="TextAppearance.Dot.Medium" parent="TextAppearance.AppCompat.Medium" />
<style name="TextAppearance.Dot.Medium.Instruction" />
Drawables

You can also override the following drawable resources.

R.drawable.dot_fingers_fingers_auto_capture_detection_layer

Security guidelines

Our video injection prevention feature relies heavily on following established security best practices as outlined in the Android Developer website’s Security guidelines. Specifically, the App Integrity and Networking sections provide crucial foundations for this functionality. The Play Integrity API ensures your app binary remains unaltered, preventing potential vulnerabilities that could be exploited for video injection. Networking Security guidelines help secure communication channels. These guidelines help prevent unauthorized modification of data streams. By adhering to these security principles, you create a robust environment where our video injection prevention features can function optimally, safeguarding you from tampered content.

OWASP Mobile Application Security

We also strongly recommend following the OWASP Mobile Application Security guidelines. The OWASP Mobile Application Security (MAS) flagship project provides a security standard for mobile apps (OWASP MASVS) and a comprehensive testing guide (OWASP MASTG) that covers the processes, techniques, and tools used during a mobile app security test, as well as an exhaustive set of test cases that enables testers to deliver consistent and complete results.