Skip to main content
Skip table of contents

Android Quickstart Sample App

Get started by running the 4FingerID Sample App and review its code alongside the Android integration guide. Code can be repurposed for your own application.

Sample App (sample-ffid-export)

The 4Fingers ID sample-ffid-export app demonstrates Veridium SDK integration and use of 4Fingers ID. It is intended as a minimal functional example and demonstrates:

  • Licensing

  • SDK initialisation

  • Format selection

  • Fingerprint export with various configurations

  • Finger Selection

WARNING

If your license is only valid for 4Finger ID it will only function with the sample-ffid-export app, not any other Veridium sample app.

Please remove all previous versions of the sample apps before installing. These apps require a minimum of Android API 21 (Android 5.0, Lollipop).

This guide does not cover using the emulator due to use of hardware cameras.

Build and Run

To build and run sample-ffid-export

  1. Download and extract the VeridiumSDK_Android_[version].zip package as provided by your Veridium salesperson. The sample-ffid-export app is located at the root.

  2. In Android Studio got to File->Open and open the root directory of the Veridium SDK package. If Android studio requests that you install the required Android SDK Platforms and Tools, do so.

  3. In the project tab, in the left side navigation window, select Android from the dropdown view options. You will see all the available sample apps and gradle scripts, including sample-ffid-export.

  4. In the run configurations dropdown in the toolbar, select sample-ffid-export.app.

  5. Clean the project by menu selecting Build->Clean and then build the app via Build->Rebuild. This should successfully build the application.

  6. A licence string is required, provided by your Veridium representative. This is an online licence and requires the device to have internet access. Unzip the licence package and open sdk.lic with a text editor [Note: the file is UTF-8 plain text encoded]. Copy the whole licence string.

  7. In Android Studio, under Gradle Scripts in the left pane navigation, open build.gradle (Module:sample-ffid-export:app) and paste the string to replace <licence> at

    CODE
    ```
    // TODO add here the VERIDIUM SDK licence
    manifestPlaceholders = [VERIDIUM_SDK_LICENSE: "<licence>"]
    ```
  8. Your licence is tied to the app's applicationId. If required, change the applicationId in the build.gradle to that indicated by your Veridium salesperson. As supplied, the ID is set as applicationId "com.veridiumid.sample.export".

  9. Connect an Android device via USB. Ensure the device has USB debugging enabled within Developer Options. Select the device from the available devices dropdown on the toolbar. [Note: the method of accessing Developer Options varies between devices. Please consult documentation from the manufacturer]

  10. Uninstall older versions of the app from the device.

  11. Hit the run toolbar button to launch the app on the device. On first operation the app will ask for permissions. Press Allow or the app will not function.

App Features

The app has a basic home screen layout (res/layout/fragment_home.xml) with buttons for running different configurations, a drop down for export format selection, and checkboxes for enabling liveness and dev output (useful for debugging).

CustomFourFBiometricsActivity extends FourFBiometricsActivity and is used to override core behaviour. This activity will be launched by the Veridium SDK during 4F operations.

CustomFourFBiometricsActivity uses the default storage where templates are stored locally on the device:

CODE
@Override
protected IKVStore openStorage() {
    return DataStorage.getDefaultStorage();
}

Note the important entry in AndroidManifest.xml configuring CustomFourFBiometricsActivity as the 4F activity via com.veridiumid.sdk.component.config meta-data, and setting of portrait only mode:

CODE
<activity
    android:name=".ui.main.CustomFourFBiometricsActivity"
    ....
</activity>

MainFragmentActvity initialises the Veridium SDK in initSDK() and sets up the buttons for the various configurations. For example, ExportConfig static methods are used to set the capture configuration:

CODE
ExportConfig.setFingersToCapture(ExportConfig.ExportMode.EIGHT_F);
ExportConfig.optimiseForIndexLittle(false);
ExportConfig.optimiseForIndex(false);

An intent is then created and started, e.g.:

CODE
Intent captureIntent = mBiometricSDK.export(FourFInterface.UID);
startActivityForResult(captureIntent, REQUEST_CAPTURE_8F);

NOTE: The Veridium SDK will itself ask for the appropriate permissions from the user if the enclosing app has not yet requested them.

A custom IBiometricResultsHandler is used to process the result by calling the parse() method of BiometricResultsParser:

CODE
BiometricResultsParser.parse(resultCode, data, customCaptureHandler);

handleSuccess() is overridden and extracts the byte[] template data out of the Map<String, byte[][]> results map for the key FourFInterface.UID. Dimension of the byte array are as follows:

  • byte[0][] - Enrolment template data.

  • byte[1][] - Export template data in the configured format

  • byte[2][] - Development output contained in zip format

The app then writes the template data to disk with writeTemplate().

veridium-finger-selection provides example UI for finger selection. ExportConfig are set directly within FingerSelectionActivity in response to the fingers chosen by the user.

CODE
homeFragment.button_select_missing_fingers.setOnClickListener(v -> {
    Intent intent = new Intent(MainFragmentActivity.this, FingerSelectionActivity.class);
    startActivityForResult(intent, REQUEST_APP_MISSING_FINGERS);
});

Access Saved Templates

Templates are written to local storage within the app's data cache at Android/data/com.veridiumid.sample.export. This a secure area not accessible by other apps.

On macOS, we recommend installing Android File Transfer for accessing the device's filesystem. Unlock your device, connect it via USB and, if prompted via notification, set the USB connection type as File transfer. Android File Transfer will open to show you the file system. Simply navigate to Android/data/com.veridiumid.sample.export and drag and rop template files to your Mac's filesystem. If template files fail to show, disconnect and reconnect the device to refresh the displayed file list.

On Windows, unlock your device, connect it via USB and, if prompted via notification, set the USB connection type as File transfer. Access the device's file system via Windows Explorer and navigate to Android/data/com.veridiumid.sample.export.

Troubleshooting

License Troubleshooting

  • The provided licence is for specific features. Ensure you are running the correct app, sample-ffid-export.

  • Ensure your licence copied correctly without introducing new lines. Your text editor should open the the licence file as UTF-8.

  • Double check the applicatonid matches that indicated by your Veridium salesperson.

  • Ensure the device has internet access.

  • Uninstall the app, clean, build, and re-install.

  • In Android Studio, open Logcat in the bottom pane. Ensure the correct device is selected and filter by package:mine. Copy the whole contents of Logcat following app start, and send it to your Veridium rep.

  • Screenshot where you're entering the licence and send to your Veridium salesperson.

  • We are always happy to take a call to resolve sample app build issues.

Other Issues

  • In Android Studio, if updating from a previous SDK version, you may need to clean the caches via File->Invalidate caches...

  • If your device does not show, disconnect it, go to developer options and select Revoke USB debugging authorisations. Reconnect the device and it should prompt to Allow USB debugging.

  • In case of the error Error:Execution failed for task ':sample-ffid-export:mergeDebugResources this is typically caused by the directory path to the project being too long. Reduce the length of the folder names.r

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.