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
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.
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.
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.
In the run configurations dropdown in the toolbar, select sample-ffid-export.app.
Clean the project by menu selecting Build->Clean and then build the app via Build->Rebuild. This should successfully build the application.
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.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>"] ```
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"
.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]
Uninstall older versions of the app from the device.
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:
@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:
<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:
ExportConfig.setFingersToCapture(ExportConfig.ExportMode.EIGHT_F);
ExportConfig.optimiseForIndexLittle(false);
ExportConfig.optimiseForIndex(false);
An intent is then created and started, e.g.:
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
:
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.
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