Capture SDK Guide
The purpose of the Integration Guide is to give developers everything they need to set up and work with a minimally viable application using the Capture SDK.
Introduction
The CaptureSDK is targeted to developers who want to use IDEMIA technologies within their mobile apps.
The main features are:
- Biometric captures
- Biometric coding
- Fingerprint capture and matching
- Biometric authentication and identification
- Identity documents reading
Adding the SDK to your project
Gradle
Configure repository:
XML1buildscript {2 repositories {3 maven {4 url "$repositoryUrlMI"5 credentials {6 username "$artifactoryUserMI"7 password "$artifactoryPasswordMI"8 }9 }10 ...11 }12 ...13}
repositoryUrlMI: Mobile Identity artifactory repository url
artifactoryUserMI: Mobile Identity artifactory username
artifactoryPasswordMI: Mobile Identity artifactory password
These properties can be obtained through Experience Portal(My Identity Proofing -> Access) and should be stored in local gradle.properties file. In such case credentials will not be included in source code. Configuration of properties:
XML1artifactoryUserMI=artifactory_user2artifactoryPasswordMI=artifactory_credentials3repositoryUrlMI=https://mi-artifactory.otlabs.fr/artifactory/smartsdk-android-local
More about gradle properties can be found here.
For biometric features the dependency is:
Groovy1implementation("morpho.mph_bio_sdk.android:SmartBio:version")
For document features the dependency is:
Groovy1implementation("morpho.mph_bio_sdk.android:SmartDoc:version")
For all features the dependency is:
Groovy1implementation("morpho.mph_bio_sdk.android:SmartSDK:version")
Version: artifact version
Components
The SDK comprises six distinct components:
- BioCaptureHandler: Handles the capture of the biometrics through the camera of the device.
- BioMatcherHandler: Handles the biometric coding and matching.
- BioStoreDB: Repository to store biometric templates. (This component is optional, in case you don't want to implement your own database.)
- ImageUtils: Handles the image format conversion, in case the integrator must change the image format or import an image.
- LicenseManager: Handles the license management. Refer to License Manager for more details.
Access to BioCaptureHandler
, BioMatcherHandler
and DocumentCaptureHandler
is through the
Biometric Capture SDK entry points.
Design considerations
-
User permissions must be handled by the integrator. You must check that the app permissions are granted by the user if the Android version is higher than 23 (as detailed here).
-
Remember: You must always have a valid license before using any method of this SDK. You can activate it through
LicenseManager
. Refer to License Manager for more details. -
Note: If your app is to run in low memory devices, you must add
android:largeHeap="true"
to your application. -
If you find that your project requires other native libraries, you must add in your gradle.properties file the following filter:
XML1android.useDeprecatedNdk=true
And in your build.gradle add filters for the desired ABI. For now, the SDK supports armeabi-v7a and arm64-v8a:
XML1defaultConfig {2 ....3 ndk.abiFilters 'armeabi-v7a','arm64-v8a'4 }
Prerequisites
Skills required
The integration tasks should be done by developers with knowledge of:
- Android Studio
- Java for Android
- Android OS
Resources required
Integration may be performed on computers running Windows, Linux, or macOS.
The tools required are:
- Android Studio
- Android SDK tools: preferred latest version
- JDK: preferred latest version
- Android device (emulator is not supported)
- Minimum SDK version is 21
Biometric capture SDK structure
The SDK's structure is displayed below.
Tips
App size optimization
After adding the SDK to your project you will observe that the size of application has grown significantly. This is because the SDK now includes native libraries for two ABIs: armeabi-v7a and arm64-v8a. What is generated is an .apk file that deploys to Google Play. Your application will contain both application binary interfaces even if one is not used.
Android App Bundle is the solution for this issue. Instead of generating an .apk, it is possible to generate a bundle (.aab). When a user installs the application from the store that contains the bundle, only the required components for the user's specific device will be downloaded.
Additionally, the maximum size of the bundle increases to 150 MB (100 MB is still maximum size for .apk files).
No changes on Google Play are required - just upload .aab instead of .apk. Also, no development in the application project is required.
It is recommended that the bundle options be declared inside the Gradle file, for example:
XML1android {2 ...3 bundle {4 density {5 enableSplit true6 }7 abi {8 enableSplit true9 }10 language {11 enableSplit false12 }13 }14}
More about app bundles can be found here.
License manager
The purpose of this section is to show the API of the license management portion of the SDK, and expose the objects involved.
License manager
The License manager is the main entry point to use the SDK. You can manage licenses through LicenseManager
.
Note: A valid license is required before using any feature of the SDK.
provideLicenseManager
This method provides an instance of LicenseManager with a predefined LKMS profile. Operation with LicenseManager should be executed before starting capture.
Kotlin1LicenseManager manager = LicenseManager.provideLicenseManager (LkmsProfileId, LkmsApiKey, lkmsUrl)
Activating license
This function takes care of making sure a valid license is stored on the device. This process is crucial and must occur each time before any SDK usage. In most cases it does not require any effort from integrator side. However, it might fail in some corner cases that are listed below.
Method handles license management on calling thread.
Callback solution:
Kotlin1val activationResult = manager.activate(2 object: LicenseActivationListener {3 override fun onLicenseActivated() {4 //License fetched and activated with success.5 }67 override fun onLicenseActivationFailed(licenseActivationError: LicenseActivationError) {8 //Failed to fetch or activate the license.9 }10 },11 applicationContext12 )
Coroutines solution: It returns LicenseActivationResult
Kotlin1val activationResult = manager.activate(applicationContext)2 when(activationResult) {3 is LicenseActivationSuccess -> {4 //License fetched and activated with success.5 }6 is LicenseActivationError -> {7 //Failed to fetch or activate the license.8 }9 }
LicenseActivationResult
This is information of result from activation license using coroutines solution. Instance might be type of:
- LicenseActivationSuccess
- LicenseActivationError
LicenseActivationError
This is the information about why license can not be activated.
Attribute | Description |
---|---|
type ActivationErrorType | The type of error why license activation failed |
message String | The activation failure reason. |
ActivationErrorType
Attribute | Description |
---|---|
PROFILE_EXPIRED | Profile expired, all licenses won’t work anymore. (Contact with support) |
ACTIVATION_COUNT_EXCEEDED | No more licenses can be consumed. (Contact with support) |
AUTHENTICATION_ISSUE | Credentials and/or profile information are wrong. |
CONNECTION_ISSUE | Connection issue. Make sure that your internet connection is stable. |
UNKNOWN | Unknown issue. |
Getting started
This guide illustrates the required steps to configure a minimally viable project for capturing biometrics using the Biometric Capture SDK.
Downloadable sample app is here:
Creating your app
- Add the SDK library to your app's
build.gradle
:
Groovy1implementation("morpho.mph_bio_sdk.android:SmartBio:version")
If you do not have configured repository for the SDK yet, see introduction that explains how to do that.
- Add the correct plugin dependency if you use face capture.
Plugins are special extensions to the SDK that might add or change its features. In this way, users can save memory and increase performance by picking plugins they need.
For face capture there are three plugins to choose from. There should be only one plugin selected during the build. If more than one for a
specific flavor is selected, it will cause a MultipleFaceInitPluginsException
.
Available plugins
-
plugin-face-normal should be used when WebBioServer is not used and there is need for strong security during local liveness challenges.
-
plugin-face-lite should be used when WebBioServer is used because it can reduce the size of an application significantly.
-
plugin-face-cr2dmatching should be used for local usage with additional security feature for
FaceLiveness.ACTIVE mode
.
Example plugin dependency for face capture:
Groovy1implementation 'com.idemia.smartsdk:plugin-face-normal:version'
Plugins for face matching
If you use the finger only variant you can skip this section because the proper plugin is already attached to that version.
For face matching there are three options to choose from. Keep in mind that these algorithms are not compatible.
Stored templates will not be successfully matched against templates from another algorithm.
-
plugin-algorithm-f5-4-low75: This has been improved to perform better with default compression. If a previous SDK has been used before and there is a user base with stored templates already, then full migration will be required. All templates must be generated again with the new plugin in use.
-
plugin-algorithm-f5-0-vid81: This is the default algorithm that is compatible with previous SDK versions.
-
plugin-algorithm-fingerv9: This provides only finger matching.
-
plugin-algorithm-f6-5-low70: Recommended algorithm for face matching, introduced in SDK version 4.44.0. There is no compatibility in the template level with other plugins.
Remember to attach only one matching plugin per flavor, otherwise a MultipleInitBlockPluginsException
will occur.
- Add the
CaptureView
to the layout where you handle the biometric capture:
XML1<com.idemia.smartsdk.preview.CaptureView2 android:id="@+id/captureView"3 android:layout_width="match_parent"4 android:layout_height="match_parent" />
- On your activity or fragment get a reference to this view:
Java1CaptureView cameraPreview = (CaptureView) findViewById(R.id.captureView);
- Activate your license. This can be done in the
onCreate(Bundle savedInstanceState)
or in a previous stage of your app. This must be done only once.
Java1LicenseManager manager = LicenseManager.provideLicenseManager(LkmsProfileId, LkmsApiKey, lkmsUrl)2 val activationResult = manager.activate(applicationContext)3 when(activationResult) {4 is LicenseActivationSuccess -> {5 //License fetched and activated with success.6 }7 is LicenseActivationError -> {8 //Failed to fetch or activate the license.9 }10 }
For security reasons it is good to consider storing LKMS credentials outside source code (for example gradle properties).
- Prepare capture settings. For finger capture, you should use
FingerCaptureOptions
.
Java1FingerCaptureOptions captureOptions = new FingerCaptureOptions(BioCaptureMode.FINGERS, Hand.RIGHT);2 captureOptions.setCamera(Camera.REAR);3 captureOptions.setLiveness(Liveness.MEDIUM);4 captureOptions.setCaptureTimeout(10);5 captureOptions.setOverlay(Overlay.ON);
- In the
onResume()
method of your activity or fragment, obtain a valid reference to theIBioCaptureHandler
using the previously created capture options.
Java1protected void onResume() {2 //Create handler3 BioSdk.createFingerCaptureHandler(activity, captureOptions, new MscAsyncCallbacks<IFingerCaptureHandler>() {4 @Override5 public void onPreExecute() {6 // Optional hook on the builtin Android AsyncTask call-back `onPreExecute`7 }89 @Override10 public void onSuccess(IFingerCaptureHandler result) {11 // Indicates that initialization succeeded, the returned handler can be used to start the capture.12 fingerCaptureHandler = result;13 }1415 public void onError(BioCaptureHandlerError e) {16 // An error has occurred during the initialization17 }18 }19 super.onResume();20 }
- Add the listeners for the events to the handler:
Java1fingerCaptureHandler.setFingerCaptureResultListener(new FingerCaptureResultListener() {2 @Override3 public void onCaptureSuccess (4 @NotNull List <MorphoImage> images,5 @NotNull List<FingerImagePreview> imagesToDisplay,6 @NotNull FingerCaptureResult captureResult) {78 }9 public void onCaptureFailure (@NotNull CaptureError captureError,10 @NotNull IBiometricInfo biometricInfo,11 @NotNull Bundle extraInfo){1213 }14});
- Initialize the preview and capture to start receiving events. It should happen after creating the capture handler. The most common place
for this would be
onResume
:
1 fingerCaptureHandler.startPreview(new PreviewStatusListener() {2 @Override3 public void onStarted() {4 try {5 fingerCaptureHandler.startCapture();6 } catch (MSCException e) {7 // handle exception8 }9 }1011 @Override12 public void onError(PreviewError error) {13 // Preview initialization failed and can not be started14 }15 });
- Destroy the handler when
onPause()
is invoked:
Java1@Override2 protected void onPause() {3 if (captureHandler!=null) {4 fingerCaptureHandler.stopCapture();5 fingerCaptureHandler.stopPreview();6 fingerCaptureHandler.destroy();7 }8 super.onPause();9 }
- In your manifest, you must add:
XML1<!--Declare new permissions-->2 <permission3 android:name="your.new.permission.NEW_READ_MPH_BIO_SDK_PROVIDER"4 android:protectionLevel="signature" /> <!--unless otherwise required, set the maximum security permission -->5 <permission6 android:name="your.new.permission.NEW_WRITE_MPH_BIO_SDK_PROVIDER"7 android:protectionLevel="signature" /> <!--unless otherwise required, set the maximum security permission -->
XML1<!--The provider must be defined by the implementing app so as to allow multiple apps-->2 <!--Bio store provider provider-->3 <provider4 android:name="com.morpho.mph_bio_sdk.android.sdk.content_provider.BioStoreProvider"5 android:authorities="your.new.authority"6 android:readPermission="your.new.permission.NEW_READ_MPH_BIO_SDK_PROVIDER"7 android:writePermission="your.new.permission.NEW_WRITE_MPH_BIO_SDK_PROVIDER"8 tools:replace="android:authorities, android:readPermission, android:writePermission">9 </provider>
Analytics
Capture SDK offers a logging mechanism that collects analytics data about SDK usage, and sends this data to IDEMIA's server. This data helps IDEMIA to improve Capture SDK and the likelihood of integrator success within the app. It is strongly recommended to activate the analytics mechanism.
- You can enable or disable sending analytics data.
- You can choose to send analytics data only when you are connected to a Wi-Fi network, so as not to not use your cellular connection.
- Analytics data that IDEMIA collects contains only technical data.
- No sensitive personal data is collected.
- IDEMIA does not collect any images.
Analytics data that we collect include following information:
- Application name, bundle id, version
- Capture SDK and RemoteLogger libraries versions
- Device model and operating system version
- Technical information about performed face, finger, and document capture (such as: capture mode used; timestamp; reason of error; time needed to perform a capture; quality of captured image; and light condition)
- Technical information about performed authentication and identification events (such as: used threshold, duration, and obtained score)
- Other technical information (such as: image compression, occurred errors, and SDK performance) that does not contain personal data
You can disable analytics reporting using the appropriate SDK method.
Capture SDK plugins
Plugins have been introduced to give even more flexibility than variants of the SDK. Every integrator might have different needs and size requirements. A new plugin mechanism allows for greater flexibility. Plugins are split to two groups: feature and algorithm.
Feature plugins
Provides various SDK functionalities such as: face capture, document capture, and optical character recognition (OCR).
Algorithm plugins
Provides for extracting biometric data from images, matching this data, and storing it as templates.
How it works
Capture SDK still has previous variants with predefined plugins in the dependency list that are still required. However, some features might be different, like the matching algorithm or face capture challenge behavior. In such cases, these features might be configured via adding specific plugins.
All that must be done to add a plugin is to put the proper dependency to a project's module that will be using the plugin (How to use them).
Benefits
The obvious benefit is reducing the number of SDK variants which makes it easier to pick the proper SDK dependency. It also brings flexibility to the product, namely, the ability to mix or replace features in the future or even extend SDK possibilities by implementing your own plugins.
How to use them
Plugins are just ordinary dependencies. All that must be done is to add the proper dependency for the plugins that are needed. Read carefully about allowed combinations and predefined plugins in SDK variants.
Here is a snippet with all available plugins:
Gradle1//Feature plugins2implementation 'com.idemia.smartsdk:plugin-finger:$version'3implementation 'com.idemia.smartsdk:plugin-face:$version'4implementation 'com.idemia.smartsdk:plugin-face-normal:$version'5implementation 'com.idemia.smartsdk:plugin-face-lite:$version'6implementation 'com.idemia.smartsdk:plugin-face-cr2dmatching:$version'7implementation 'com.idemia.smartsdk:plugin-face:$version'8implementation 'com.idemia.smartsdk:plugin-improved-pdf417-detection:$version'910//Algorithm plugins11implementation 'com.idemia.smartsdk:plugin-algorithm-f5-0-vid81:$version'12implementation 'com.idemia.smartsdk:plugin-algorithm-f5-4-low75:$version'13implementation 'com.idemia.smartsdk:plugin-algorithm-f6-0-idd80:$version'14implementation 'com.idemia.smartsdk:plugin-algorithm-f6-5-low70:$version'15implementation 'com.idemia.smartsdk:plugin-algorithm-fingerv9:$version'
Allowed combinations
Here are all possible combinations of plugins for specific use cases.
As mentioned above, the SDK variants have predefined plugins dependency, so that only a few must be defined.
See what predefined plugins has which variant of the SDK you use.
Face capture |
---|
plugin-face |
plugin-face-lite |
plugin-face-normal |
plugin-face-cr2dmatching |
Available algorithm plugins |
plugin-algorithm-f5-4-low75 |
plugin-algorithm-f5-0-vid81 |
plugin-algorithm-f6-5-low70 |
plugin-algorithm-f6-0-idd80 |
Finger capture |
---|
plugin-finger |
Available algorithm plugins |
plugin-algorithm-f5-4-low75 |
plugin-algorithm-f5-0-vid81 |
plugin-algorithm-f6-0-idd80 |
plugin-algorithm-f6-5-low70 |
plugin-algorithm-fingerv9 |
Document capture |
---|
plugin-improved-pdf417-detection |
Warning: Only one of: plugin-face-lite, plugin-face-normal, plugin-face-cr2dmatching can be used at a time. The integrator must pick one of them. A MultipleFaceInitPluginsException
will occur if more than one has been picked.
SDK variants and their plugins
Each SDK plugin variant delivers something different - check carefully what each plugin variant contains. Plugin variants should not be added in a module that uses this specific variant. As can be seen below, no document-related plugins must be added for variants that deliver this feature. In other words, variants contain all plugins that are required and have no alternatives.
Capture SDK |
---|
plugin-face |
plugin-finger |
Plugins that might be added for a Capture SDK variant:
- One of: plugin-face-normal, plugin-face-lite, plugin-face-cr2dmatching
- One of: plugin-algorithm-f5-4-low75, plugin-algorithm-f5-0-vid81, plugin-algorithm-f6-0-idd80, plugin-algorithm-f6-5-low70, plugin-algorithm-fingerv9* (this one is not recommended if face matching will be performed)
Biometric Capture SDK |
---|
plugin-face |
plugin-finger |
Plugins that can be added for the Biometric Capture SDK variant:
- One of: plugin-face-normal, plugin-face-lite, plugin-face-cr2dmatching
- One of: plugin-algorithm-f5-4-low75, plugin-algorithm-f5-0-vid81, plugin-algorithm-f6-0-idd80, plugin-algorithm-f6-5-low70 plugin-algorithm-fingerv9 (this one is not recommended if face matching is going to be performed)
SmartFinger |
---|
plugin-finger |
plugin-algorithm-fingerv9 |
There are no plugins for the SmartFinger variant.
SmartFace |
---|
plugin-face |
Plugins that can be added for the SmartFace variant:
- One of: plugin-face-normal, plugin-face-lite, plugin-face-cr2dmatching
- One of: plugin-algorithm-f5-4-low75, plugin-algorithm-f5-0-vid81, plugin-algorithm-f6-0-idd80, plugin-algorithm-f6-5-low70
SmartFaceDoc |
---|
plugin-face |
plugin-face-lite |
Plugins that can be added for the SmartFaceDoc variant:
- One of: plugin-algorithm-f5-4-low75, plugin-algorithm-f5-0-vid81, plugin-algorithm-f6-0-idd80, plugin-algorithm-f6-5-low70
However, this variant is meant to be used with WebBioServer which performs matching operations (no need to do that locally).
For SDK variants with document plugin-improved-pdf417-detection may be added in order to improve capture of barcodes.
Feature plugins descriptions
plugin-face
Basic plugin needed for face capture. Usually it is predefined in every SDK variant that delivers face capture functionality.
plugin-face-normal
Should be used for face capture when WebBioServer is not used and there is a need for strong security during local liveness challenges.
plugin-face-lite
Should be used when WebBioServer is used for liveness check during face capture, because it can reduce the size of application significantly.
plugin-face-cr2dmatching
Should be used for local usage (without WebBioServer) when additional security feature for FaceLiveness.ACTIVE
mode is needed.
plugin-finger
Plugin needed for finger capture. Usually it is predefined in every SDK variant that delivers finger capture functionality.
plugin-improved-pdf417-detection
Plugin that can be used to speed up barcode capture.
Algorithm plugins descriptions
plugin-algorithm-f6-0-idd80
It is more accurate than f5-4-low75 and much smaller than f5-0-vid81.
plugin-algorithm-f5-4-low75
Improved to perform better with default compression. If a previous SDK has been used before and there is a user base with stored templates already, then full migration of the user's biometrics will be required. All templates must be generated again with the new plugin in use.
plugin-algorithm-f5-0-vid81
This is the default algorithm that is compatible with previous SDK versions.
plugin-algorithm-f6-5-low70
Recommended algorithm for face capture. It is more accurate than f6-0-idd80. If a previous SDK has been used before and there is a user base with stored templates already, then full migration of the user's biometrics will be required. All templates must be generated again with the new plugin in use.
plugin-algorithm-fingerv9
Provides only finger matching feature. It is best to pick this one when only finger matching will be performed.
WARNING
The algorithms are NOT compatible with each other. The templates generated by one of the algorithms cannot be processed with the other one; that is, it is not possible to match a template generated with F6_0_IDD80 against a template generated with F5_4_LOW75 or F5_0_VID81. If an integrator wants to change the algorithm in their solution, all the stored templates must be recreated with the new algorithm.
SDK size
This is the estimated size of an SDK variant with all its dependencies, like predefined plugins (see Plugins section). The UI-extension is not included in size as it is not a predefined dependency.
SDK variant | Size |
---|---|
CaptureFace | 24.29 MB |
CaptureDocument | 16.94 MB |
CaptureFinger | 17.24 MB |
CaptureBiometry | 28.78 MB |
CaptureBiometry_document | 43.48 MB |
CaptureFace_document | 38.99 MB |
Plugins size
Plugin | Size |
---|---|
plugin-face | 7.59 KB |
plugin-face-normal | 6.75 MB |
plugin-face-lite | 4.79 MB |
plugin-face-cr2dmatching | 6.75 MB |
plugin-finger | 794.64 KB |
plugin-algorithm-f5-4-low75 | 12.30 MB |
plugin-algorithm-f5-0-vid81 | 4.08 MB |
plugin-algorithm-f6-5-low70 | 7.45 MB |
plugin-algorithm-fingerv9 | 1.51 KB |
plugin-improved-pdf417-detection | 8.81MB |
Integration guide
The purpose of this document is to show the API of the SDK and expose all of its involved objects.
Use cases
Capture biometrics
Below is the generic execution flow to perform a biometric capture (Get Picture), and get information about the biometry. For example, getting a picture and moving your head to the left.
Capture timeout
Below is the generic execution flow to be followed when a capture timeout occurs.
Capture enroll
Below is the generic execution flow to perform a biometric capture (Get Picture). After that, the biometrics template is extracted from
the image returned by the capture component. The biometric template is linked to one user using the userUUID
. The UUID
of this template
and the userUUID
are stored in a database.
Capture authenticate
Below is the generic execution flow to perform a biometric capture (Get Picture). The biometrics template is then extracted from the image
and returned by the capture component. These are the candidate templates that you must use to create an IBiometricCandidate
.
After the IBiometricCandidate
is created, a list of reference templates must be extracted. These will then be used to create
an IBiometricReference
object with which to match against the IBiometricCandidate
and authenticate that the candidate templates belong
to the user.
There are two ways to extract a list of template references: the first is to retrieve them from the database used during the enrollment
process; the second is to extract the templates from another image with detectBiometrics(...)
.
Capture identify
Below is the generic execution flow to perform a biometric capture (Get Picture). The biometrics template is then extracted from the image
and returned by the capture component. These are the candidate templates which you must use to create an IBiometricCandidate
.
After the IBiometricCandidate
is created, a list of reference templates must be extracted. These will then be used to create
an IBiometricReference
object with which to match against the IBiometricCandidate
and authenticate that the candidate templates belong
to the user.
Creating BioMatcherHandler
Below is the generic execution flow to retrieve and release a BioMatcherhandler
.
Authenticating
Below is the generic execution flow to perform a generic verification process which involves extracting the biometrics template from an
image. These are the candidate templates which you must use to create an IBiometricCandidate
.
After the IBiometricCandidate
is created, a list of reference templates must be extracted. These will then be used to create
an IBiometricReference
object with which to match against the IBiometricCandidate
and authenticate that the candidate templates belong
to the user.
There are two ways to extract a list of template references: the first is to retrieve them from the database used during the enrollment
process; the second to is extract the templates from another image with detectBiometrics(...)
.
Identifying
Below is the generic execution flow to perform a generic identification process which involves extracting the biometrics template from an
image. These are the candidate templates which you must use to create an IBiometricCandidate
.
After the IBiometricCandidate
is created, a list of reference templates must be extracted. These will then be used to create
an IBiometricReference
object with which to match against the IBiometricCandidate
and authenticate that the candidate templates belong
to the user.
Detect biometrics
This describes detecting the biometrics in an IImage
. This function is intended to be used to extract all the biometric templates
contained in an image; for example, all the faces that are in an image.
Finger capture
Overview
Finger ridges have tiny minutiae that makes them difficult to alter. They are unique to each individual and durable over a lifetime. The probability of two people having the same fingerprints is approximately 1 in 64,000,000,000. This makes finger ridges the ideal long-term markers for human identity.
The Capture SDK applies this characteristic for easy authentication and identification using any modern Android or iOS smartphone equipped with a standard camera. Capture SDK is a software library used for scanning fingerprints.
Capture SDK features
-
Fingerprint acquisition results in raw images of finger ridges.
Note: The conversion into worldwide WSQ1 format with a built-in converter is possible.
-
Biometric data extraction.
-
Biometric data storage.
-
Biometric data comparison to authenticate (1:1) or identify (1
)Note: Once the biometric data is extracted, you can utilize the fast authentication mode. This reduces the process to encompass fingerprint acquisition and authentication only.
Dependencies
Implement a dependence with either a predefined or custom configuration:
Predefined:
XML1implementatation "morpho.mph_bio_sdk.android:SmartFinger:$smartSdkVersion"
Custom:
XML1implementation "morpho.mph_bio_sdk.android:SmartSDK:$smartSdkVersion"2 implementation "com.idemia.smartsdk:plugin-algorithm-fingerv9:$smartSdkVersion"
More details about plugin dependencies can be found here
Description
There are four main components that can be used together or separately, depending on the use case: FingerCaptureHandler, BioMatcherHandler, ImageUtils, BioStoreDB.
FingerCaptureHandler is an extension of BioCaptureHandler which is a part of Biometric Capture SDK. It can capture, check liveness, and authenticate an user's fingerprints.
There are three available modes:
-
FINGERS
,THUMB
- captures fingerprint images (fingers or thumb, respectively) and optionally checks liveness. -
AUTHENTICATION
- captures fingerprint images, checks liveness, and determines whether the captured data matches with the chosen template.
BioMatcherHandler extracts templates with biometric data from images and also compare them. As a result of the comparison, score
is
returned. The score
value determines if both templates belong to the same user or
not. Read more about BioMatcherHandler
ImageUtils uses various conversion types; read section about ImageUtils.
BioStoreDB persists the templates when implemented by the integrator. Use of this component is optional.
Summary
-
To create a FingerCaptureHandler instance you must declare the FingerCaptureOptions.
Regardless of the capture mode, set the basic configuration:
- specify capture mode
- whether a UI overlay be visible during capture
- which of smartphone's cameras should be used to perform capture
- what level of liveness check should be performed
- declare timeout to define capture's duration
When you choose
FINGERS
mode you can set which fingers are missing to capture. Default is zero amputated fingers. When you chooseTHUMB
you can only scan a thumb. -
When the FingerCaptureOptions configuration completes, create FingerCaptureHandler.
-
Register the listener with result callbacks.
-
To perform a capture, start the camera preview and then start the capture.
-
After the time declared in the FingerCaptureOptions passes, the result callback is returned.
For code examples, recommended configuration, and more detailed description, check the page dedicated to a specific capture option.
Fast authentication
Fast Authentication
is a special mode to authenticate fingerprints right after capture. There is one mode that can be used:
AUTHENTICATION
for fingers
To use this mode you should have a list of MorphoTemplate
templates from fingerprints that have been saved from previous captures during
enrollment. These templates will be used to compare with current fingerprints from the current captures.
This mode returns IAuthenticationResult.
Flow
- Create
LicenseMangager
. - Retrieve the license.
- Activate the license.
- Get a list of templates from
MorphoTemplate
. - Create a
BiometricReference
. - Create the
FingerCaptionOptions
with addedBiometricReference
and threshold. - Create the
FingerCaptureHandler
. - Set the listener,
setAuthenticationListener
. - Start the capture.
- On
callback
, process the result. - Stop the capture.
Below is the sequence diagram of that flow.
Creating fast authentication use case
- Create a biometric reference.
Get the user instance form BioStoreDB
and choose MorphoTemplate
for the finger.
From the BioStoreDB
get the list of MorphoTemplate
templates and create IBiometricReference
.
Kotlin1BioStoreDB.listUsers(2 this@FingerCameraActivity,3 object : DataBaseAsyncCallbacks<List<IUser>> {4 override fun onPreExecute() {}5 override fun onSuccess(iUsers: List<IUser>) {6 if (iUsers.isNotEmpty()) {7 val user = iUsers[0]8 BioStoreDB.listTemplates(9 this@FingerCameraActivity,10 user.uuid,11 BiometricModality.FRICTION_RIDGE,12 object : DataBaseAsyncCallbacks<List<IMorphoTemplate>> {13 override fun onPreExecute() {}1415 override fun onSuccess(references: List<IMorphoTemplate>) {16 ...17 //reference candidates18 val reference = BiometricReference(user.uuid, BiometricModality.FRICTION_RIDGE)19 reference.addTemplates(references)20 ...21 }2223 override fun onError(e: Exception) {}24 })25 }26 }2728 override fun onError(e: Exception) {}29})
- Add to
FingerCaptureOptions
theIBiometricReference
with a threshold and create theFingerCaptureHandler
.
Create FingerCaptureOptions
with the added threshold
and biometricRefernece
. Then create FingerCaptureHandler
.
Kotlin1val fingerCaptureOptions = FingerCaptureOptions(BioCaptureMode.FINGERS, Hand.RIGHT)2captureOptions.liveness = FingerLiveness.LOW3captureOptions.bioCaptureMode = BioCaptureMode.FINGERS4captureOptions.camera = Camera.REAR5captureOptions.overlay = Overlay.ON6captureOptions.captureTimeout = 107fingerCaptureOptions.biometricReference = reference8fingerCaptureOptions.threshold = 30009fingerCaptureOptions.uhdResolutionEnabled = true10createFingerCaptureHandler(fingerCaptureOptions)1112BioSdk.createFingerCaptureHandler(this, captureOptions, object : MscAsyncCallbacks<IFingerCaptureHandler> {13 override fun onPreExecute() {}14 override fun onSuccess(result: IFingerCaptureHandler) {15 onFingerCaptureInitialized(result)16 }1718 override fun onError(e: BioCaptureHandlerError) {}19})
- Add the listener to the
FingerCaptureHandler
responsible for thefast authentication
result.
To create a FingerCaptureHandler
, add the callback responsible for Fast Authentication
. In this callback, process the result. The next
step will vary based on individual business workflows.
Kotlin1fingerCaptureHandler.setAuthenthicationListener{ authenticationResult ->2 if (authenticationResult.status == AuthenticationStatus.SUCCESS) {3 onAuthenticationSuccess(authenticationResult)4 } else {5 onAuthenticationFailure(authenticationResult)6 }7}
Results
IAuthenticationResult
This is the interface that represents an authentication result.
Parameter | Description |
---|---|
score long | The authentication score (between 0 and 50000). |
authenticationStatus AuthenticationStatus | The authentication status. |
AuthenticationStatus
This is the enum class that represents whether the authentication is successful or not.
The authentication is successful when the score is greater than the threshold.
Parameter | Description |
---|---|
SUCCESS | Authentication was successful. |
FAILURE | Authentication was not successful. |
Capture errors
Errors returned when finger capture fails.
Name | When | Why |
---|---|---|
CAPTURE_TIMEOUT | Used time for capture | Fingers were not captured properly in time |
CAPTURE_DELAYED | Failing captures repeatedly | Prevent spoofing |
BAD_CAPTURE_FINGERS | Capture of fingers failed | Couldn't find fingerprints on captured image |
BAD_CAPTURE_HAND | Capture of hand failed | Wrong hand scanned |
LIVENESS_CHECK | Liveness check failed | Fingerprints do not belong to a living person |
Creating a BioMatcher Handler
This allows you to retrieve a handler to perform all the matching, identifying, and template coding operations.
-
Review the use cases named Create BioMatcherHandler.
-
Review the features provided by this handler here.
Java1IBioMatcherSettings bioMatcherSettings = new BioMatcherSettings();2 bioMatcherSettings.setLogLevel(LogLevel.DISABLE);3 bioMatcherSettings.setDumpFileEnable(false);4 bioMatcherSettings.setDumpFileFolder(null);5 //To configure finger print template format6 bioMatcherSettings.setFingerprintTemplate(MorphoFingerTemplateFormat.PKCOMPV2);7 BioSdk.createBioMatcherHandler(this, bioMatcherSettings, new BioMatcherAsyncCallbacks<IBioMatcherHandler>() {8 @Override9 public void onPreExecute() {10 // Optional hook on the builtin Android AsyncTask call-back `onPreExecute`11 }1213 @Override14 public void onSuccess(IBioMatcherHandler result) {15 // Indicates that initialization succeeded. The returned handler can be used to perform the matching and identify operations.16 }1718 @Override19 public void onError(Exception e) {20 // An error has occurred.21 }22 });
Parameter | Description |
---|---|
context Context | The Android context. |
settings IBioMatcherSettings | The settings to configure the matcher. |
callbacks BioMatcherAsyncCallbacks | Callbacks to be executed depending on the result. |
Errors
You will receive an exception reporting the error.
Handlers
This section discusses the BioCapture
handler, FingerCapture
handler, and BioMatcher
handler.
BioCapture handler
You must retrieve the capture handler through the Biometric Capture SDK entry point.
Finger tracking listener
This sets the listener to receive feedback associated with the finger as shown in the snippet:
Java1captureHandler.setFingerTrackingListener(new FingerCaptureTrackingListener() {2 @Override3 public void onTracking(@NotNull List<FingerTracking> trackingInfo) {45 }6});
Start preview
This asynchronously starts the camera preview. It is recommended to start the capture once the preview has been initialized, as shown in the snippet:
1handler.startPreview(new PreviewStatusListener() {2 @Override3 public void onStarted() {4 try {5 captureHandler.startCapture();6 } catch (MSCException e) {7 // handle exception8 }9 }1011 @Override12 public void onError (PreviewError error) {13 // Preview initialization failed and can not be started14 }15});
Stop preview
This stops the camera preview as shown in the snippet:
Java1handler.stopPreview();
Start capture
This starts the biometric capture as shown in the snippet.
Java1handler.startCapture();
Stop capture
This stops the biometric capture as shown in the snippet:
Java1handler.stopCapture();
Switch camera
This switches between different cameras as shown in the snippet:
Java1handler.switchCamera(Camera.FRONT); // Use front camera2handler.switchCamera(Camera.REAR); // Use rear camera
Destroy
This releases all the handler resources as shown in the snippet:
Java1handler.destroy();
Overlay
This sets the overlay option.
Java1handler.setOverlay(Overlay.OFF); // Disable preview's overlay2handler.setOverlay(Overlay.ON); // Enable preview's overlay
CaptureOptions
This retrieves the capture options used in this handler as shown in the snippet:
Java1ICaptureOptions options = handler.getCaptureOptions();
Force capture
This forces a capture as shown in the snippet:
Java1handler.forceCapture();
Capture handler status
Note: Check CaptureHandlerStatus.
This retrieves the status of the capture handler as shown in the snippet:
Java1CaptureHandlerStatus captureHandlerStatus = handler.getCaptureStatus();
FingerCapture handler
You must retrieve the capture handler through the Biometric Capture SDK entry point for BioCaptureHandler
as shown in the snippet:
Java1// Get activity from application2 Activity activity = ...3 // Populate a CaptureOptions object4 IFingerCaptureOptions captureOptions = new FingerCaptureOptions();5 captureOptions.setBioCaptureMode(BioCaptureMode.ONE_FINGER);6 captureOptions.setLiveness(Liveness.MEDIUM);7 captureOptions.setCamera(Camera.FRONT);8 captureOptions.setCaptureTimeout(10);9 captureOptions.setOverlay(Overlay.OFF);10 //////////////////////////////////11 //Get the biometric reference12 IBiometricReference biometricReference = ...13 captureOptions.setBiometricReference(biometricReference);14 //////////////////////////////////15 BioSdk.createFingerCaptureHandler(activity, captureOptions, new MscAsyncCallbacks<IFingerCaptureHandler>() {16 @Override17 public void onPreExecute() {18 // Optional hook on the builtin Android AsyncTask call-back `onPreExecute`19 }2021 @Override22 public void onSuccess(IFingerCaptureHandler result) {23 // Indicates that initialization succeeded, the returned handler can be used to start the capture.24 fingerCaptureHandler = result;25 }26 public void onError(BioCaptureHandlerError e) {27 // An error has occurred during the initialization28 }29});
Note: It extends from BioCaptureHandler.
Capture result listener
This sets the listener to receive the finger captures. Hand and fingerprints images callback will be fired when the capture finishes.
Java1fingerCaptureHandler.setFingerCaptureResultListener(new FingerCaptureResultListener() {2 @Override3 public void onCaptureSuccess(@NotNull List<MorphoImage> images,4 @NotNull List<FingerImagePreview> imagesToDisplay,5 @NotNull FingerCaptureResult captureResult) {6 }7 public void onCaptureFailure(@NotNull CaptureError captureError,8 @NotNull IBiometricInfo biometricInfo,9 @NotNull Bundle extraInfo) {10 }11});
onCaptureSuccess | Called when captured successfully finishes |
---|---|
images List | List of captured fingerprints images |
imagesToDisplay List | List of captured images with better quality which should be displayed instead of MorphoImages |
captureResult FingerCaptureResult | Holds information about the capture, like liveness |
FingerImagePreview
This object provides fingerprint images for display purposes.
Parameter | Description |
---|---|
biometricLocation BiometricLocation | The position of the biometric. |
image Bitmap | The fingerprint image. |
FingerCaptureResult
FingerCaptureResult | |
---|---|
getLivenessResult FingerLivenessResult | Resolution of capture liveness: LIVE ,FAKE ,NO_DECISION |
onCaptureFailure | Called when capture fails |
---|---|
captureError CaptureError | Reason of capture failure |
biometricInfo IBiometricInfo | Biometric information about location and classification |
extraInfo Bundle | Holds capture extra info: capture delay date |
setAuthenthicationListener
This is the listener to receive the callbacks related to the authentication process.
This is only compatible with AUTHENTICATION
.
An example snippet is shown.
Java1fingerCaptureHandler.setAuthenthicationListener(new BioCaptureAuthenticationListener() {2 @Override3 public void onAuthenticationResult(IAuthenticationResult authenticationResult) {4 String message = getString(R.string.authentication_process);5 message +="\n" + getString(R.string.score)+ " " +authenticationResult.getScore();6 message +="\n" + getString(R.string.status)+ " " +authenticationResult.getStatus();7 Toast.makeText(this, message, Toast.LENGTH_LONG).show();8 }9 });
Indication of optimal fingerprint distance
Methods described below may be used to improve user experience of fingerprint acquisition. They works only with specific, calibrated devices.
getCaptureDistanceRange
Returns CaptureDistanceRangeResult
, which may be one of the following:
CaptureDistanceRangeSuccess | Returned if the device is calibrated for finger distance management feature |
---|---|
captureDistanceRange CaptureDistanceRange | Contains optimal distance ranges between the fingers and the lens |
CaptureDistanceRangeUnavailable | Returned if the device is not calibrated for finger distance management feature or any other error has occurred |
---|---|
reason String | The reason of the distance range unavailibility, e.g. "The device is not calibrated for this feature" |
|
CaptureDistanceRange
CaptureDistanceRange | |
---|---|
rangeMin float | Minimum value that may be returned in _FingerCaptureCurrentDistanceListener. Should be equal to 0.0 |
optimalMin float | Lower boundary of optimal distance between the phone and the fingers |
optimalMax float | Upper boundary of optimal distance between the phone and the fingers |
rangeMax float | Maximum value that may be returned in FingerCaptureCurrentDistanceListener. Should be equal to 1.0 |
setFingerCaptureCurrentDistanceListener
To receive the feedback about current distance between the fingers and the phone lens (e.g in order to create your own optimal distance indicator on UI), you should register listener as shown in the snippet:
1 captureHandler.setFingerCaptureCurrentDistanceListener(new FingerCaptureCurrentDistanceListener() {2 @Override3 public void onCurrentCaptureDistance(@NonNull CurrentCaptureDistance currentCaptureDistance) {4 //handle currentCaptureDistance5 }6 });
onCurrentCaptureDistance | Called when the distance between the fingers and the phone lens changes |
---|---|
currentCaptureDistance CurrentCaptureDistance | Contains the distance between the phone lens and the fingers |
CurrentCaptureDistance
CurrentCaptureDistance | |
---|---|
value float | Value of the distance between the phone lens and the fingers. This value is between rangeMin and rangeMax from CaptureDistanceRange . To indicate the correctness of the distance between the fingers and the phone camera you should check if it is between optimalMin and optimalMax . |
setFingerCaptureFeedbackListener
Returns feedback associated with finger capture (for example if the distance between the phone lens and the fingers is optimal). Snippet below shows how to register the listener:
1 captureHandler.setFingerCaptureFeedbackListener(new FingerCaptureFeedbackListener() {2 @Override3 public void onCurrentCaptureDistance(@NonNull captureInfo: FingerCaptureInfo) {4 //handle captureInfo5 }6 });
onCaptureInfo | |
---|---|
captureInfo FingerCaptureInfo _ | Information whether the distance between the fingers and the phone lens is correct. It may be OPTIMAL , TOO_CLOSE or TOO_FAR |
BioMatcher handler
This interface provides all the necessary helper methods to perform all the matching, identifying, and template coding operations.
Authenticate
This verifies a list of candidate templates against a list of reference templates. This method can be used to authenticate users.
Note: Review the use cases named Authenticate.
An example snippet is shown:
Java1//Authentication options2IAuthenticationOptions authenticationOptions = new AuthenticationOptions();3authenticationOptions.setThreshold(3500);45//Biometric candidate6IBiometricCandidate biometricCandidate = new BiometricCandidate(BiometricModality.FACE);7//We add all the templates for this candidate8biometricCandidate.addTemplates(candidates);910//Biometric references11IBiometricReference biometricReference = new BiometricReference(user.getUuid(), BiometricModality.FACE);12//We add all the templates for this user13biometricReference.addTemplates(references);1415matcherHandler.authenticate(authenticationOptions, biometricCandidate, biometricReference, new BioMatcherAsyncCallbacks<IAuthenticationResult>() {16 @Override17 public void onPreExecute() {18 // Optional hook on the builtin Android AsyncTask callback `onPreExecute`19 }2021 @Override22 public void onSuccess(IAuthenticationResult result) {23 //The result of the authentication24 long resultScore = result.getScore();25 //authentication status (FAILURE, SUCCESS...)26 AuthenticationStatus authenticationStatus = authenticationResult.getStatus();27 }2829 @Override30 public void onError (Exception e){31 // An error has occurred32 }33});
Function
Java1void authenticate(IAuthenticationOptions authenticationOptions, IBiometricCandidate biometricCandidate, IBiometricReference biometricReference, BioMatcherAsyncCallbacks<IAuthenticationResult> callbacks);
Parameter | Description |
---|---|
authenticationOptions IAuthenticationOptions | The options used to perform the authentication. |
biometricCandidate IBiometricCandidate | It contains the list of templates that you want to match. |
biometricReference IBiometricReference | It contains the list of templates that you want to use as reference, each of one has the userUUID to which they belong. |
callbacks BioMatcherAsyncCallbacks | Callbacks to be executed depending on the result; refer to IAuthenticationResult. |
Errors
You will receive an exception reporting the error.
Authenticate synchronous
This verifies a list of candidate templates against a list of reference templates. This method can be used to authenticate users.
Note: This function must be executed in a different thread than the UI. Check the use cases named Authenticate.
An example snippet is shown:
Java1//Authentication options2IAuthenticationOptions authenticationOptions = new AuthenticationOptions();3authenticationOptions.setThreshold(3500);45//Biometric candidate6IBiometricCandidate biometricCandidate = new BiometricCandidate(BiometricModality.FACE);7//We add all the templates for this candidate8biometricCandidate.addTemplates(candidates);910//Biometric references11IBiometricReference biometricReference = new BiometricReference(user.getUuid(), BiometricModality.FACE);12//We add all the templates for this user13biometricReference.addTemplates(references);1415IAuthenticationResult result = matcherHandler.authenticate(authenticationOptions, biometricCandidate, biometricReference);16//The result of the authentication17long resultScore = result.getScore();18//authentication status (FAILURE, SUCCESS...)19AuthenticationStatus authenticationStatus = authenticationResult.getStatus();
Function
An example snippet is shown.
Java1IAuthenticationResult authenticate(IAuthenticationOptions authenticationOptions, IBiometricCandidate biometricCandidate, IBiometricReference biometricReference);
Parameter | Description |
---|---|
authenticationOptions IAuthenticationOptions | The options used to perform the authentication. |
biometricCandidate IBiometricCandidate | Contains the list of templates that you want to match. |
biometricReference IBiometricReference | Contains the list of templates that you want to use as reference; each has the userUUID to which they belong. |
Errors
You will receive an exception reporting the error.
Identify
This method can be used to identify users. It identifies the user from the list of candidate templates that are matched against the list of reference templates.
Note: Check the use case named Identify.
An example snippet is shown:
Java1//Identification options2IIdentificationOptions identificationOptions = new IdentificationOptions();34//Biometric candidate5IBiometricCandidate biometricCandidate = new BiometricCandidate(BiometricModality.FACE);6//We add all the templates for this candidate7biometricCandidate.addTemplates(candidates);89//We create the list of references10ArrayList<IBiometricReference> biometricReferences = new ArrayList<IBiometricReference>();11//Biometric reference for one user12IBiometricReference biometricReference = new BiometricReference(user.getUuid(), BiometricModality.FACE);13//We add all the templates for this user14biometricReference.addTemplates(references);1516//We add the user to the list17biometricReferences.add(biometricReference);1819matcherHandler.identify(identificationOptions, biometricCandidate, biometricReferences, new BioMatcherAsyncCallbacks<IIdentificationResult>() {20 @Override21 public void onPreExecute() {22 // Optional hook on the builtin Android AsyncTask callback `onPreExecute`23 }2425 @Override26 public void onSuccess(IIdentificationResult result) {27 //The identification result28 List<IIdentificationCandidate> candidates = result.getIdentificationCandidateList();29 if (candidates.size() > 0) {30 IIdentificationCandidate candidate = candidates.get(0);31 UUID userUUID = candidate.getUuid();32 long candidateScore = candidate.getScore();33 }3435 }3637 @Override38 public void onError(Exception e) {39 // An error has occurred40 }41});
Function
An example snippet is shown.
Java1void identify(IIdentificationOptions identificationOptions, IBiometricCandidate biometricCandidate, List<IBiometricReference> biometricReferences, BioMatcherAsyncCallbacks<IIdentificationResult> callbacks);
Parameter | Description |
---|---|
identificationOptions IIdentificationOptions | The options used to perform the identification |
biometricCandidate IBiometricCandidate | Contains the list of templates that you want to match |
biometricReferences List<IBiometricReference> | Contains the list of references against you will identify your candidate—check IBiometricReference |
callbacks BioMatcherAsyncCallbacks | Callbacks to be executed depending on the result—check IIdentificationResult |
Errors
You will receive an exception reporting the error.
Identify synchronous
This method can be used to identify users.
It identifies the user from the list of candidate templates that are matched against a list of reference templates.
Note: This function must be executed in a different thread than UI. Check the use case named Identify.
An example snippet is shown.
Java1//Identification options2IIdentificationOptions identificationOptions = new IdentificationOptions();34//Biometric candidate5IBiometricCandidate biometricCandidate = new BiometricCandidate(BiometricModality.FACE);6//We add all the templates for this candidate7biometricCandidate.addTemplates(candidates);89//We create the list of references10ArrayList<IBiometricReference> biometricReferences = new ArrayList<IBiometricReference>();11//Biometric reference for one user12IBiometricReference biometricReference = new BiometricReference(user.getUuid(), BiometricModality.FACE);13//We add all the templates for this user14biometricReference.addTemplates(references);1516//We add the user to the list17biometricReferences.add(biometricReference);1819IIdentificationResult result = matcherHandler.identify(identificationOptions, biometricCandidate, biometricReferences)20//The identification result21List<IIdentificationCandidate> candidates = result.getIdentificationCandidateList();22if (candidates.size() > 0) {23 IIdentificationCandidate candidate = candidates.get(0);24 UUID userUUID = candidate.getUuid();25 long candidateScore = candidate.getScore();26}
Function
An example snippet is shown.
Java1IIdentificationResult identify(IIdentificationOptions identificationOptions, IBiometricCandidate biometricCandidate, List<IBiometricReference> biometricReferences);
Parameter | Description |
---|---|
identificationOptions IIdentificationOptions | The options used to perform the identification. |
biometricCandidate IBiometricCandidate | Contains the list of templates that you want to match. |
biometricReferences List<IBiometricReference> | Contains the list of references against which you will identify your candidate; refer to IBiometricReference |
Errors
You will receive an exception reporting the error.
Detect biometrics
This allows you to detect the biometrics in a MorphoImage
.
This function extracts all the biometric templates contained in an image (such as, all the faces that are in an image).
Note: Check the use case named Detect Biometric.
Java1//Create a populate options2 IDetectBiometricOptions detectBiometricsOptions = new DetectBiometricsOptions();3 detectBiometricsOptions.setBiometricLocation(BiometricLocation.FACE_FRONTAL);4 detectBiometricsOptions.setBiometricModality(BiometricModality.FACE);56 bioMatcherHandler.detectBiometric(detectBiometricsOptions, image, new BioMatcherAsyncCallbacks<List<IMorphoTemplate>>() {7 @Override8 public void onPreExecute() {9 // Optional hook on the builtin Android AsyncTask callback `onPreExecute`10 }1112 @Override13 public void onSuccess(List<IMorphoTemplate> result) {14 //A List of templates extracted from the image15 }1617 @Override18 public void onError(Exception e) {19 // An error has occurred20 }21 });
Function
An example snippet is shown.
Java1public void detectBiometric(final IDetectBiometricOptions detectBiometricsOptions, final IImage image, BioMatcherAsyncCallbacks<List<IMorphoTemplate>> callbacks)
Parameter | Description |
---|---|
detectBiometricsOptions IDetectBiometricOptions | The options used during the detection process. |
image IImage | The image. |
callbacks BioMatcherAsyncCallbacks | Callbacks to be executed depending on the result. |
Errors
You will receive an exception reporting the error.
Detect biometric synchronous
This allows you to detect the biometrics in a MorphoImage
.
This function extracts all the biometric templates contained in an image (such as, all the faces that are in an image).
Note: This function must be executed in a different thread than the UI. Check the use case named Detect Biometric.
An example snippet is shown.
Java1// Create a populate options2IDetectBiometricOptions detectBiometricsOptions = new DetectBiometricsOptions();3detectBiometricsOptions.setBiometricLocation(BiometricLocation.FACE_FRONTAL);4detectBiometricsOptions.setBiometricModality(BiometricModality.FACE);56//A List of templates extracted from the image7List<IMorphoTemplate> templates = bioMatcherHandler.detectBiometric(detectBiometricsOptions, image);
Function
An example snippet is shown.
Java1public List<IMorphoTemplate> detectBiometric(final IDetectBiometricOptions detectBiometricsOptions, final IImage image)
Parameter | Description |
---|---|
detectBiometricsOptions IDetectBiometricOptions | The options to use during the detection process. |
image IImage | The image. |
Errors
You will receive an exception reporting the error.
Destroy
This releases all the handler resources as shown in the snippet:
Java1handler.destroy();
BioStore
With the BioStore
component you can save biometric templates in a device's memory. Usage of this component is optional, depending on the
integrator's needs.
BioStore allows operations for a specific user like: listing templates, adding new templated, updating templates, removing templates.
A more detailed description about BioStore can be found here
Usage
The most common use case for BioStore
is to save a template and restore it later to do matching against a new capture. To do this, there
must be at least one user added.
Add new user
1IUser user = new User();2user.setName("Name");3BioStoreDB.addUser(context, user, new DataBaseAsyncCallbacks<UUID>() {4 @Override5 public void onPreExecute() {6 // Optional hook on the builtin Android AsyncTask callback `onPreExecute`7 }89 @Override10 public void onSuccess(UUID result) {11 //User saved12 }1314 @Override15 public void onError(Exception e) {16 // An error has occurred17 }18});
Listing saved templates for the finger
This lists the templates stored in the repository and filters them by user and BiometricModality.
1BioStoreDB.listTemplates(context, userId, BiometricModality.FRICTION_RIDGE, new DataBaseAsyncCallbacks<List<IMorphoTemplate>>() {2 @Override3 public void onPreExecute() {4 // Optional hook on the builtin Android AsyncTask callback `onPreExecute`5 }67 @Override8 public void onSuccess(List<IMorphoTemplate> result) {9 //The list of templates that match the criteria10 }1112 @Override13 public void onError(Exception e) {14 // An error has occurred15 }16});
Save templates for the finger
Store a template in the repository. If there is a previous template with the same user UUID
, the biometric location and biometric modality
will be updated and their UUID
returned.
Note: There cannot be two templates with the same configuration.
1BioStoreDB.addTemplate(context, morphoTemplate, new DataBaseAsyncCallbacks<UUID>() {2 @Override3 public void onPreExecute() {4 // Optional hook on the builtin Android AsyncTask callback `onPreExecute`5 }67 @Override8 public void onSuccess(UUID result) {9 //The template has been added, and template's uuid is returned as a parameter10 }1112 @Override13 public void onError(Exception e) {14 // An error has occurred15 }16});
Finger matching
The Capture SDKs can match biometric templates with the same biometric modality to get the IAuthenticationResult
, which is based on a
similarity score.
An example of such a comparison follows.
Matching flow
BioMatcherHandler creation
1IBioMatcherHandler matcherHandler = null;2IBioMatcherSettings bioMatcherSettings = new BioMatcherSettings();3 //To configure finger print template format4 bioMatcherSettings.setFingerprintTemplate(MorphoFingerTemplateFormat.PKCOMPV2);5 BioSdk.createBioMatcherHandler(this, bioMatcherSettings, new BioMatcherAsyncCallbacks<IBioMatcherHandler>() {6 @Override7 public void onPreExecute() {8 // Optional hook on the builtin Android AsyncTask call-back `onPreExecute`9 }1011 @Override12 public void onSuccess(IBioMatcherHandler result) {13 // Indicates that initialization succeeded, the returned handler can be used to perform the matching and identify operations.14 matcherHandler = result;15 }1617 @Override18 public void onError(Exception e) {19 // An error has occurred20 }21 });
Authentication
Requirements
-
Create a BioMatcherHandler. More about MatcherHandler.
-
Obtain candidate fingerprints' templates. In most use cases they are acquired during the enrollment process.
-
Obtain reference templates for matching. It is possible to match templates stored in a database or other persistence solution, but in most cases a reference is acquired from a previous finger capture during the authentication process.
-
Before matching, authentication options must be created. Such options contain the threshold that must be exceeded by the matching score to have a successful authentication.
-
Once those items are complete, the biometric candidate can be matched against the reference. As a result the
IAuthenticationResult
object will be returned. It has two fields:status
- indicating if the authentication is successful or not andscore
which might be in the range 0 – 50000.
1//Authentication options2IAuthenticationOptions authenticationOptions = new AuthenticationOptions();3authenticationOptions.setThreshold(3500);45//Biometric candidate6IBiometricCandidate biometricCandidate = new BiometricCandidate(BiometricModality.FRICTION_RIDGE);7//We add all the templates for this candidate8biometricCandidate.addTemplates(candidates);910//Biometric references11IBiometricReference biometricReference = new BiometricReference(user.getUuid(), BiometricModality.FRICTION_RIDGE);12//We add all the templates for this user13biometricReference.addTemplates(references);1415matcherHandler.authenticate(authenticationOptions, biometricCandidate, biometricReference, new BioMatcherAsyncCallbacks<IAuthenticationResult>() {16 @Override17 public void onPreExecute() {18 // Optional hook on the builtin Android AsyncTask callback `onPreExecute`19 }2021 @Override22 public void onSuccess(IAuthenticationResult result) {23 //The result of the authentication24 long resultScore = result.getScore();25 //authentication status (FAILURE, SUCCESS...)26 AuthenticationStatus authenticationStatus = authenticationResult.getStatus();27 }2829 @Override30 public void onError(Exception e) {31 // An error has occurred32 }33});
Parameters
Parameter | Description |
---|---|
authenticationOptions IAuthenticationOptions | The options used to perform the authentication. This object holds the threshold that the score must exceed to accept the candidate. |
biometricCandidate IBiometricCandidate | Contains the list of templates to match against. |
biometricReference IBiometricReference | Contains the list of templates for reference; each of one has the userUUID to which they belong. |
Passive capture
Passive capture captures fingerprints without any challenges performed by the user.
There are two BioCaptureMode values available for finger capture:
- FINGERS for scans of 1 to 4 fingers.
- THUMB` for scans of one finger
Parameters
Parameter | Short description | Recommended value |
---|---|---|
BioCaptureMode | Capture modes that are described earlier | BioCaptureMode.FINGERPRINT_RIGHT_CAPTURE |
Overlay | Intuitive rectangles that help the user properly place their fingers during a capture | Overlay.ON |
Camera | Smartphone's camera that will be used during the capture | Camera.REAR |
Liveness | Level of challenge that the fingers image must pass to be considered alive | FingerLiveness.MEDIUM |
Timeout | Duration of capture in seconds | ~10 |
amputeeFingers | Information about which fingers are missing with BioCaptureMode.FINGERS | |
hand | Information about which hand will be scanned |
Capture flow
Sequence diagram
-
After the activation of license, create the handler with the necessary defined capture options.
-
Register the listener to get the result callbacks.
-
When it finishes, use the handler to start the camera preview and capture respectively.
Note: After the capture is finished, remember to stop the preview and the capture. When you finish, destroy the capture.
Note that diagram represents abstract BioCapture flow. FingerCapture differs with its capture result listener. More information is in listeners.
-
The capture starts just after the camera preview is started.
-
The capture lasts as long as the
timeout
duration previously set.
The user must fit and stabilize their fingers inside a preview screen during the capture process. It is recommended to turn on the overlay
in the capture settings that displays an intuitive UI.
Capture screen with overlay
Capture options configuration
Kotlin1val options = FingerCaptureOptions()2 options.bioCaptureMode = BioCaptureMode.FINGERS3 options.overlay = Overlay.ON4 options.camera = Camera.REAR5 options.captureTimeout = 106 options.liveness = FingerLiveness.MEDIUM
The smartphone's camera is on by default as it is recommended for better capture performance. However, it can be turned off
if needed.
Listeners
FingerCaptureResultListener has two methods: onCaptureSuccess
and onCaptureFailure
. These return result data on a successful capture
and a capture error on a capture with errors.
Kotlin1val handler = BioSdk.createFingerCaptureHandler(context, options)2 handler.setFingerCaptureResultListener(object : FingerCaptureResultListener {3 override fun onCaptureFailure(captureError: CaptureError, biometricInfo: IBiometricInfo, extraInfo: Bundle) {4 // handle capture failure5 }67 // deprecated8 override fun onCaptureSuccess(9 images: MutableList<MorphoImage>,10 captureResult: FingerCaptureResult11 ) {12 // handle capture success13 }14 override fun onCaptureSuccess(15 images: List<MorphoImage>,16 imagesToDisplay: List<FingerImagePreview>,17 captureResult: FingerCaptureResult18 ) {19 // handle capture success20 }21 }
Result
On a successful capture:
-
A list of five images of the type
MorphoImage
is returned, where one image contains all of the fingers and four gray-scale fingerprint images that represents separate fingers compressed with a WSQ algorithm. -
FingerCaptureResult, where its data should be considered only if
FingerLiveness
has a value other thanFingerLiveness.NONE
. It consists of ascore
value that represents the confidence of liveness recognition and theFingerLivenessResult
that holds the decision on whether the captured fingers belongs to a real person or not. -
A list of
FingerImagePreview
images, as name suggests these images are dedicated to UI purposes only. If you need to display captured finerprint images, these images are the right choice. For matching, please use images from list mentioned above (MorphoImage
).
Helper objects
Get debug data
You can save some captured data on a device's memory. In some cases, those files might help to solve some issues. Data can be found on the
SD card in the SmartSDK_debug_data
directory.
An example on how to configure the debug data options is shown in the snippet:
Java1[...]2 DebugSettingsBuilder debugSettingsBuilder = new DebugSettingsBuilder();3 debugSettingsBuilder.logLevel(logLevel)4 .storingType(DataStoringType.LAST_SESSION_ONLY)5 .recordRtv(DebugOption.DISABLED)6 .recordPostMortemRtv(DebugOption.DISABLED)7 .saveCapturedImages(DebugOption.DISABLED);8 captureOptions.setDebugDataSettings(debugSettingsBuilder.build());
DataStoringType
can have two values: LAST_SESSION_ONLY
and MULTIPLE_SESSIONS
. The first one overwrites data in a single directory. The
second makes a separate directory per capture.
There is also an option to store a special .rtv
file that helps you understand what is happening during the capture.
Note: These files take a lot of space. LogLevel
describes what part of the logs will be saved to a file. If needed, the integrator
can also save captured images by enabling the saveCapturedImages
option.
BioSdk class - enableAnalytics
This method turns on the reporting and sending analytics report. It also changes the analytics server and its API key.
NOTE: The server is set to Europe by default.
Parameter | Description |
---|---|
network Network | Preferred network type that will be used to send the report. |
analyticsConfigurationData AnalyticsConfigurationData | Class that allows the setting of SERVER URL and API KEY . |
BioSdk class - disableAnalytics
This turns off the reporting and sending analytics report.
Note: By default, the analytics mechanism is turned on and the server is set to Europe.
This section describes the helper objects that are necessary to use the Biometric Capture SDK.
BioSdk class - IBioSdkInfo
This object exposes information about the SDK. An example snippet is shown:
Java1IBioSdkInfo sdkInfo = BioSdk.getInfo();
Parameter | Description |
---|---|
version String | The version of the SDK |
MscAsyncCallbacks
Generic callbacks which execute task asynchronous.
Function
Kotlin1fun onPreExecute() {23}
Function
Kotlin1fun onSuccess(result: T) {2 //on success3}
Arguments
Parameter | Description |
---|---|
result T | return on success with result type set when callback was created |
Function
Kotlin1fun onError(e: BioCaptureHandlerError) {2 //on success3}
Arguments
Parameter | Description |
---|---|
e BioCaptureHandlerError | An error |
IBioMatcherSettings
This object is used to configure the behavior of BioMatcher
.
Attribute | Description |
---|---|
debugDataSettings DebugDataSettings | Sets options used for preparing debug data dump |
fingerTemplateFormat MorphoFingerTemplateFormat | Finger template format, only used for fingerprints—default format is PKLITE |
ICaptureOptions
This object is used to configure the behavior of Capture
.
Attribute | Description |
---|---|
camera Camera | The app camera option to configure BioCapture . |
overlay Overlay | Sets the overlay value. |
captureTimeout Long | Capture timeout in seconds (default value 120 ). |
logLevel LogLevel | Sets the log level. |
DebugDataSettings Debug Data | Sets debug data options that stores key information about capture on the device's memory. |
FingerCaptureOptions
This object is used to configure the behavior of FingerCapture
. It extends from CaptureOptions.
Attribute | Description |
---|---|
biometricReference IBiometricReference | The biometric reference to use during the finger authentication. Only compatible with capture mode AUTHENTICATION . Check IBiometricReference. |
threshold long | Set threshold for finger capture with success |
crossMatchingVerificationThreshold long | Deprecated Used for verification mechanism to set threshold |
liveness FingerLiveness | Set liveness security |
bioCaptureMode BioCaptureMode | Set capture mode for finger |
amputeeFingers AmputeeFingers | Set which fingers Person does not have. Only compatible with FINGERS . |
hand Hand | Set which hand will be scanned |
UHDResolutionEnabled boolean | Enables or disables capture in 4K (Feature for testing. Development using 4k resolution is not ready for use.) |
Warning: UHD resolution is not working properly for all devices, it is in experimental state.
IBiometricSet
This is a common interface that all the candidates and references that perform authentication and identification operations extend.
Parameter | Description |
---|---|
templates List<IMorphoTemplate> | The Biometric templates; refer to IMorphoTemplate |
biometricModality BiometricModality | The BiometricModality enum option. |
IBiometricCandidate
This is a common interface that all the candidates extend. It extends IBiometricSet.
IBiometricReference
This is a common interface that all the references used to perform an authentication or identification extend. It extends IBiometricSet.
Parameter | Description |
---|---|
userUuid UUID | User uuid |
IBiometricInfo
This is a common interface that all the different Biometrics implement.
Parameter | Description |
---|---|
biometricLocation BiometricLocation | The BiometricLocation enum option. |
biometricModality BiometricModality | The BiometricModality enum option. |
BiometricInfo
This is a common object that all the different Biometrics extend. It implements the interface IBiometricInfo.
IImage
This is an image interface that the SDK image objects will extend.
Parameter | Description |
---|---|
buffer byte[] | The image |
stride int | The stride of the biometric |
width long | The width of the image |
height long | The height of the image |
colorSpace ColorSpace | The colorspace of the image |
resolution float | The resolution of the image. |
imageQuality int | Image quality if available, otherwise -1 . Currently only available for fingerprint images. |
label String | Label associated to this image, if any. It can be null . |
toJPEG byte[] | Retrieves the image as a JPEG image with default quality. Default for finger is 90%. Default for finger is 80%. Created JPEG for face will contain capture maker note data inside EXIF metadata containing information such as for example SDK version used for capturing the image. |
toJPEG(float quality) | Retrieves the image as a JPEG image with quality equal from 0 to 1. Created JPEG for face will contain capture maker note data inside EXIF metadata containing information such as for example SDK version used for capturing the image. |
MorphoImage
This is the image object returned by the SDK. It extends BiometricInfo and implements IImage.
FingerTracking
This is a finger tracking object returned by the FingerCaptureTrackingListener
.
Parameter | Description |
---|---|
rect Rect | The position of the biometric. |
previewRect Rect | The original preview size to which the coordinates are referred. |
orientation Int | Orientation of finger in degrees |
quality FingerQuality | Quality of finger |
FingerQuality enum
This enum retrieves information about quality of the face saved in template.
Attribute | Description |
---|---|
UNAVAILABLE | The quality is unavailable because the acquisition process is still ongoing. |
LOW | A low-quality fingerprint is a fingerprint image that lacks clarity and detail. |
MEDIUM | A medium-quality fingerprint is a fingerprint image that captures a fair amount of detail. |
HIGH | A high-quality fingerprint is a fingerprint image that is exceptionally clear and detailed, with distinct ridge patterns and minimal noise or distortion. This level of quality ensures the most reliable and accurate identification. |
OvalOverlay
Information about oval overlay that might help user to position face correctly in front of camera. Keep in mind these numbers are relative to preview image size. If you want to display some UI elements helping user to place his face, using UIExtensions library is recommended. Otherwise you have to rescale these coordinates by your own to fit your view.
Parameter | Description |
---|---|
width float | The width length of the oval. |
height float | The height length of the oval. |
centerX float | The position x of oval center. |
centerY float | The position y of oval center. |
IMorphoTemplate
This is the biometric template object returned by the SDK. It extends IBiometricInfo.
Parameter | Description |
---|---|
buffer byte[] | The template. |
uuid UUID | The template uuid in the database (Can be null ). |
uuidUser UUID | The user uuid (Can be null ). |
IMorphoFingerTemplate
This is the biometric finger template object returned by the SDK. It extends IMorphoTemplate.
Parameter | Description |
---|---|
fingerPosition IFingerPosition | The finger position. |
templateFormat MorphoFingerTemplateFormat | The template format–check MorphoFingerTemplateFormat |
IFingerPosition
This is class with information about position of finger.
Description | |
---|---|
getPosition() RectF | Get location of finger on camera. |
AmputeeFingers
This is information for capture which fingers the user is missing.
Description | |
---|---|
addMissingFinger() Finger | Add amputated finger to list of amputated fingers |
clearMissingFingers() | Clear list of amputated fingers |
getMissingFingers() List<Finger> | Get list of amputated fingers |
onTracking
This is invoked multiple times by BioCapture
to send feedback about the biometric positions to the app.
Function
An example snippet is shown:
Java1public void onTracking(List<MorphoBioTraking> trackingInfo);
Arguments
Parameter | Description |
---|---|
trackingInfo List<MorphoBioTraking> | The list of tracking info. |
CaptureListener
This is a generic capture listener.
onCaptureFinish
This is invoked by BioCapture
when the capture finishes.
Function
An example snippet is shown:
Java1void onCaptureFinish();
IDetectBiometricOptions
This interface represents the verification options. This interface extends IBiometricInfo.
Parameter | Description |
---|---|
isTemplateCompressionEnabled boolean | Enables or disables the template compression. For the moment this feature is only available for face. |
IMatchingOptions
This interface represents the basic matching options.
Parameter | Description |
---|---|
biometricModality BiometricModality | The BiometricModality enum option |
IAuthenticationOptions
This is the interface that represents the authentication options. This interface extends IMatchingOptions.
The matching result is a score that reflects the similarity of two biometrics acquisitions. The threshold is the score value that is used
to differentiate a HIT
from a NOHIT
.
Threshold choice is a compromise between FAR (False Acceptance Rate) and FRR (False Reject Rate).
FAR is the proportion of requests that generate an unexpected HIT
with two biometrics acquisitions of two different persons.
FRR is the proportion of requests that generate an unexpected NOHIT
with two biometrics acquisitions of the same person.
IDEMIA algorithms
The recognition algorithm similarity matching score is linked with the FAR (as previously defined):
FAR | Score |
---|---|
1% | 2500 |
0.1% | 3000 |
0.01% | 3500 |
0.001% | 4000 |
0.0001% | 4500 |
0.00001% | 5000 |
Parameter | Description |
---|---|
threshold long | The authentication threshold to be considered valid. |
IAuthenticationResult
This is the interface that represents an authentication result.
Parameter | Description |
---|---|
score long | The authentication score (between 0 - 50000). |
authenticationStatus AuthenticationStatus | The authentication status. |
IIdentificationOptions
This is the interface that represents the identification options. This interface extends IMatchingOptions.
IIdentificationResult
This is the interface that represents an identification result.
Parameter | Description |
---|---|
candidateList List<IIdentificationCandidate> | The authentication result; refer to IIdentificationCandidate. |
IIdentificationCandidate
This is the Interface that represents a candidate result.
Parameter | Description |
---|---|
uuid UUID | The candidate uuid . |
score long | The identification score result. |
Enums
ColorSpace
This is the colorspace enum.
Attribute | Description |
---|---|
Y8 | Grayscale 8bpp image. |
Y16LE | Grayscale 16bpp image (Little Endian). |
BGR24 | Colour 24bpp BGR image (BMP like memory layout). |
RGB24 | Colour 24bpp RGB image (reversed memory layout compared to RT_COLORSPACE_BGR24). |
Camera
This is the enum used to configure the camera for the capture.
Attribute | Description |
---|---|
FRONT | Front camera |
REAR | Rear camera |
CameraFlash enum
This enum is used to configure the camera flash of the capture.
Attribute | Description |
---|---|
OFF | Camera flash off |
ON | Camera flash on |
Overlay
This is the enum used to configure the overlay for the capture.
Attribute | Description |
---|---|
OFF | Overlay off |
ON | Overlay on |
LogLevel
This enum controls the log level.
Attribute | Description |
---|---|
ERROR | Error log level or above |
DEBUG | Debug log level or above |
WARNING | Warning log level or above |
INFO | Info log level or above |
DISABLE | Disables logs |
CaptureHandlerStatus enum
This enum retrieves the status of the capture handler.
Attribute | Description |
---|---|
STOP | The handler is stopped. |
PREVIEW | The handler is in preview mode. |
CAPTURE | The handler is in capture mode. |
BioCaptureHandlerError
This enums gives information why msc async failed
Attribute | Description |
---|---|
MSC_ERR_PARAMETERS | Parameters are invalid. |
MSC_ERR_PARAMETER_UNKNOWN | Parameter is missing |
MSC_ERR_MEMALLOC | Memory allocation issue |
MSC_ERR_INIT | Initialization failed |
MSC_ERR_GRAPH_INITIALISATION_FAILED | the graph initialization failed |
MSC_ERR_PARAMETER_NOT_FOUND | Parameter is missing |
MSC_ERR_PARAMETER_SIZE | Parameter size is incorrect |
MSC_ERR_TYPE_MISMATCH | MSC type mismatch |
MSC_ERR_INVALID_HANDLE | Handle is invalid |
MSC_ERR_LICENSE | License is invalid |
MSC_ERR_APPLINOTAVAILABLE | the application parameter is not available |
MSC_ERR_PROFILENOTAVAILABLE | MSC profile is not available |
NOT_EXECUTED | Java is unable to execute |
LIBS_NOT_FOUND | Java libraries are not found |
NO_CONTEXT_SET | Java context is not set |
MSC_ERR_SUBPROFILENOTAVAILABLE | MSC sub-profile is not available |
MSC_ERR_UNKNOWN | An unknown error occurred |
MSC_ERR_INVALID_OPERATION | The operation is invalid |
MSC_ERR_INCOMPATIBLE_API_VERSION | The API version is incompatible, your application must be recompiled |
MSC_ERR_PARAMETER_WRONG_TYPE | Parameter is not the right type |
MSC_ERR_PARAMETER_NOT_SET | Parameter is not set in current scope |
UNKNOWN | Unknown error |
FingerLivenessResult enum
Attribute | Description |
---|---|
LIVE | Finger is real. |
FAKE | Finger is fake. |
UNCHECKED | When liveness is turn off. |
NO_DECISION | Can not determined if finger is live or fake. |
FingerLiveness enum
This enum describes the verification strength for finger liveness capture.
Attribute | Description |
---|---|
NO_LIVENESS | No finger liveness detection is performed during capture |
VERY_LOW | Easiest finger liveness mode to pass |
LOW | More restrictive finger liveness verification |
MEDIUM | Recommended liveness mode for finger liveness capture |
Hand enum
This enum describes the captured hand for finger liveness capture.
Attribute | Description |
---|---|
RIGHT | Hand right |
LEFT | Hand Left |
Finger enum
Attribute | Description |
---|---|
INDEX | Index finger |
MIDDLE | Middle finger |
RING | Ring finger |
LITTLE | Little finger |
FingerLivenessResult enum
This enum represents the result of a finger liveness check.
Attribute | Description |
---|---|
LIVE | Liveness success - real fingers are detected |
FAKE | Liveness check failure - not real fingers |
NO_DECISION | WebBioServer is needed to make a decision |
ColorSpace enum
Attribute | Description |
---|---|
Y8 | Grayscale 8bpp image. |
Y16LE | Grayscale 16bpp image (Little Endian). |
BGR24 | Color 24bpp BGR image (BMP like memory layout). |
RGB24 | Color 24bpp RGB image (reversed memory layout compared to RT_COLORSPACE_BGR24). |
FingerCaptureInfo enum
Attribute | Description |
---|---|
OPTIMAL | The user's fingers are in optimal distance from the phone lens |
TOO_CLOSE | User should move the fingers further |
TOO_FAR | User should move the fingers closer |
BiometricLocation enum
Attribute | Description |
---|---|
FACE_FRONTAL | Face |
FINGER_RIGHT_INDEX | Right index finger |
FINGER_RIGHT_MIDDLE | Right middle finger |
FINGER_RIGHT_RING | Right ring finger |
FINGER_RIGHT_LITTLE | Right little finger |
FINGER_RIGHT_THUMB | Right thumb |
FINGER_RIGHT_FOUR | Right four fingers |
FINGER_LEFT_INDEX | Left index finger |
FINGER_LEFT_MIDDLE | Left middle finger |
FINGER_LEFT_RING | Left ring finger |
FINGER_LEFT_LITTLE | Left little finger |
FINGER_LEFT_THUMB | Left thumb |
FINGER_LEFT_FOUR | Left four fingers |
FINGER_UNKNOWN | Unknown finger |
HAND_LEFT | Left hand |
HAND_RIGHT | Right hand |
HAND_UNKNOWN | Unknown hand |
UNKNOWN | Unknown |
BiometricModality enum
Attribute | Description |
---|---|
UNKNOWN | Unknown |
FACE | Face |
FRICTION_RIDGE | Friction ridge (fingers) |
Camera enum
This enum is used to configure the behavior of BioCapture
.
Attribute | Description |
---|---|
FRONT | Front camera |
REAR | Rear camera |
CameraFlash enum
This enum is used to configure the behavior of BioCapture
.
Attribute | Description |
---|---|
OFF | Camera flash off |
ON | Camera flash on |
Overlay enum
This enum is used to configure the behavior of BioCapture
.
Attribute | Description |
---|---|
OFF | Overlay off |
ON | Overlay on |
BioCaptureMode enum
This enum is used to configure the behavior of FingerCapture
.
Attribute | Description |
---|---|
FINGERS | Fingerprint one to four finger |
THUMB | Fingerprint one finger |
AUTHENTICATION | Fingerprint authentication embedded |
The goal of the face liveness feature is to provide mechanisms that prevent or limit a variety of methods used in fraud attempts, such as the use of still images or photos or videos of a given person.
CaptureError enum
This enum reports the reason that a capture attempt failed.
Attribute | Description |
---|---|
UNKNOWN | Unknown error |
LOW_RESOLUTION | Resolution too low |
NOT_ENOUGH_MOVEMENT | Not enough movement |
TOO_FAST | Too fast |
HINT_UNKNOWN | Hint value is unknown |
CAPTURE_TIMEOUT | Capture timeout |
CAPTURE_DELAYED | Capture delayed due to liveness failures |
BAD_CAPTURE | Capture went wrong |
BAD_CAPTURE_FINGERS | Capture of the fingers went wrong |
BAD_CAPTURE_FACE | Capture of the face went wrong |
BAD_CAPTURE_HAND | Capture of the hand went wrong |
LIVENESS_CHECK | Liveness check failed |
AuthenticationStatus enum
This enum contains the authentication status.
Attribute | Description |
---|---|
SUCCESS | Authentication success (above the threshold used for the authentication process) |
FAILURE | Authentication failure (below the threshold used for the authentication process) |
LogLevel enum
This enum controls the logging level.
Attribute | Description |
---|---|
ERROR | Error log level or above |
DEBUG | Debug log level or above |
WARNING | Warning log level or above |
INFO | Info log level or above |
DISABLE | Disables logging |
MorphoFingerTemplateFormat enum
This enum retrieves information about the finger template format.
Attribute | Description |
---|---|
PKCOMPV2 | PKCOMPV2 format |
PKLITE | PKLITE format |
CaptureHandlerStatus enum
This enum retrieves the status of the capture handler.
Attribute | Description |
---|---|
STOP | The capture handler is stopped |
PREVIEW | The capture handler is in preview mode |
CAPTURE | The capture handler is in capture mode |
New finger capture API
Introduction
In order to make integration of the SDK easier and more intuitive - new API for finger capture has been delivered. It is based on self-explaining use cases which provide specific information depending on a given use case. This allows integrator to focus on working with the data provided by the SDK rather than on SDK configuration.
Old API is also available for integrators as it provides other use cases. It's description might be found here.
NOTE: For now, the new API supports only latent use case.
Integration
Integration of SDK consists of four steps:
- Activating license.
- Adding FingerCaptureView to activity.
- Creating use case.
- Setting up capture.
License activation
This part is common for old API and the new one. License handling can be found here.
Adding FingerCaptureView
FingerCaptureView has to be added to the layout of capture Activity, as for any other Android's view. It is a key component of the SDK. It not only provides preview for the capture but also is an entry point to SDK's API. It means that on this component integrator sets up capture and orchestrate it's flow. This view must be visible to the end user.
XML1<androidx.constraintlayout.widget.ConstraintLayout2 xmlns:android="http://schemas.android.com/apk/res/android"3 xmlns:app="http://schemas.android.com/apk/res-auto"4 android:layout_width="match_parent"5 android:layout_height="match_parent"6 android:orientation="horizontal">78 <com.idemia.capture.face.api.FingerCaptureView9 android:id="@+id/captureView"10 android:layout_width="match_parent"11 android:layout_height="match_parent" />1213</androidx.constraintlayout.widget.ConstraintLayout>
As FingerCaptureView is entry point to SDK, it should also be used with proper methods in application logic. This can be done by old way - with findViewById:
Kotlin1private var captureView: FingerCaptureView? = null23override fun onCreate(savedInstanceState: Bundle?) {4 super.onCreate(savedInstanceState);5 setContentView(R.layout.your_activity_layout);67 captureView = findViewById(R.id.captureView);8}
or with more up to date way - through binding:
Kotlin1lateinit var binding: YourActivityCaptureBinding2private var captureView: FingerCaptureView? = null34override fun onCreate(savedInstanceState: Bundle?) {5 super.onCreate(savedInstanceState)6 binding = YourActivityCaptureBinding.inflate(layoutInflater)7 setContentView(binding.root)89 captureView = binding.captureView10}
Creating use case
In order to perform capture, the next step is to create use case we are interested in. As mentioned above - new API focuses on what we want to do and not on how we want to do. In order to achieve that, use cases have been introduced. They define what will be done and require (at least for result) set of listeners to provide information about capture.
Currently the only available use case is LatentUseCase.
Kotlin1val latentUseCase =2 LatentUseCase(3 LatentCaptureSettings(TIMEOUT),4 LatentCaptureListeners(5 currentDistanceListener = fingerCaptureDistanceListener,6 feedbackListener = fingerCaptureFeedbackListener,7 trackingListener = fingerCaptureTrackingListener,8 result = latentResultListener,9 torchListener = torchListener10 )11 )
More about use cases and their properties can be found in dedicated section.
Setting up capture
When previous steps are completed, it is time to set up capture and perform it. In order to do that use method setUp on * FingerCaptureView*:
Kotlin1fun setUp(useCase: UseCase, lifecycle: Lifecycle?, uiSettings: UISettings?)
Please find below explanation to each function argument:
Parameter | Description |
---|---|
useCase UseCase | This is use case instance providing type of capture and allowing integrator to get data from it |
lifecycle Lifecycle | This is Android's component allowing SDK to be lifecycle aware. Argument is optional. If not provided integrator has to explicitly manage flow. If lifecycle is provided there is no need to start/cancel/destroy flow. |
uiSettings UISettings | Settings providing details to UI-Extensions library. If not provided integrator has to handle displaying proper UI to end user on his own. More information about it can be found here. |
In case that Lifecycle parameter is not provided, below methods have to be called explicitly by integrator in order to provide smooth and stable user experience:
- start() - Start's capture and liveness verification flow. Recommended to invoke it in onResume or onStart methods of Android's lifecycle.
- cancel() - Cancel's flow. Recommended to invoke it in onPause method of Android's lifecycle.
- destroy() - Clean's up capture view and it's data. Recommended to invoke it in onDestroy method of Android's lifecycle.
Assuming that above steps has been done, capture needs to be set up, as in the following example:
Kotlin1[code in Activity]23fun setupView(useCase: UseCase) {4 binding.captureView.setUp(5 useCase,6 lifecycle,7 UISettings(fingerCaptureSettings)8 )9}
Here is an example of UISettings setup.
Kotlin1val settings = fingerCaptureSettings {2 scene {3 background {4 colorEnd = Color.parseColor("#189482")5 colorStart = Color.parseColor("#38ddb8")6 }7 rectangle {8 color = Color.BLACK9 strokeWidth = 20f10 cornerRadius {11 rx = 20f12 ry = 20f13 }14 }15 previewScale {16 scaleX = 1.0f17 scaleY = 1.0f18 }19 tapping {20 colorBackground = Color.parseColor("#FAFAFA")21 colorImage = Color.parseColor("#000000")22 colorText = Color.parseColor("#000000")23 textResId = R.string.use_your_head24 textH1ResId = R.string.no_tapping_feedback25 enabled = true26 }27 feedback {28 feedbackStringMapping = mapping29 show = true30 }31 distance {32 showOptimalDistanceIndicator = true33 }34 progressBar {35 labelRes = R.string.scanning36 show = true37 }38 }39}
Contrary to using fingerCaptureSettings in legacy API, there is no need to set range parameter of distance field - it is handled internally within the SDK.
Use cases
As mentioned in sections above, new API is meant to be easier to integrate and more intuitive in general. To achieve this, use cases has been introduced. Every use case is dedicated to do particular job. Below you can find list of available use cases.
LatentUseCase
This use case can be used to capture a fingerprint of secretion of the skin. The fingerprint will be returned in PNG format. To create LatentUseCase, following properties must be provided:
- LatentCaptureSettings
- LatentCaptureListeners
Kotlin1LatentUseCase(val settings: LatentCaptureSettings, val listeners: LatentCaptureListeners)
Parameter | Description |
---|---|
settings LatentCaptureSettings | Latent capture settings. Currently it contains only one field - timeout, which indicates time of capture. |
listeners LatentCaptureListeners | Group of listeners related to latent use case. They help to gather capture data and informs about flow state and result. See listeners section for more details. |
LatentCaptureListeners - detailed description of each listener can be found in listeners section.
Parameter | Description |
---|---|
currentDistanceListener FingerCaptureDistanceListener | Provides information about optimal distance range between phone lens and fingers . This listener is optional and is useful when UISettings are not provided. |
feedbackListener FingerCaptureFeedbackListener | Provides information whether the distance between fingers and the phone is correct. Works only with calibrated devices. This listener is optional and is useful when UISettings are not provided. |
trackingListener FingerCaptureTrackingListener | Provides localisation of fingers. This listener is optional and is useful when UISettings are not provided. |
result LatentResultListener | Provides information about capture status. |
torchListener TorchListener | Provides device torch controller when available. |
Listeners
New API introduces multiple listeners to acquire capture related data by integrator. All listeners are being called on UI thread and it is safe to manipulate UI components directly from them.
FingerCaptureDistanceListener
Returns information associated with indication of optimal distance range between the phone lens and the fingerprint.
Kotlin1fun onCaptureDistanceRangeInformation(captureDistanceRangeResult: CaptureDistanceRangeResult)
CaptureDistanceRangeResult
CaptureDistanceRangeResult is a sealead class. It may be CaptureDistanceRangeSuccess or CaptureDistanceRangeUnavailable
Value | Description |
---|---|
CaptureDistanceRangeSuccess | Means that the device is calibrated for distance indication feature. Contains CaptureDistanceRange |
CaptureDistanceRangeUnavailable | Means that the device isn't calibrated for distance indication feature or retrieving optimal distance is not possible. |
CaptureDistanceRange
Parameter | Description |
---|---|
rangeMin Float | Minimum value that may be returned in boundary range. |
optimalMin Float | Lower boundary of optimal distance between the phone lens and the fingerprint. |
optimalMax Float | Upper boundary of optimal distance between the phone lens and the fingerprint. |
rangeMax Float | Maximum value that may be returned in boundary range. |
CaptureDistanceRangeUnavailable
Parameter | Description |
---|---|
reason String | A reason why CaptureDistanceRange is unavailable. |
Kotlin1fun onCurrentCaptureDistance(currentCaptureDistance: CurrentCaptureDistance)
CurrentCaptureDistance
Parameter | Description |
---|---|
value Float | Current distance between the fingerprint and the phone lens. |
FingerCaptureFeedbackListener
Provides information if the distance between fingers (fingerprints) and the phone is acceptable.
Kotlin1fun onCaptureInfo(captureInfo: FingerCaptureInfo)
FingerCaptureInfo
Value | Description |
---|---|
OPTIMAL | Indicates that the distance between the fingers (fingerprints) and the phone lens is optimal. |
TOO_CLOSE | Indicates that the phone lens is too close from the fingers (fingerprints) and should be moved further. |
TOO_FAR | Indicates that the phone lens is too far from the fingers (fingerprints) and should be moved closer. |
FingerCaptureTrackingListener
By default returns list with localisations of the fingers. For LatentUseCase this list will contain only one element which should be used to draw overlay that will show the area of a capture.
Kotlin1fun onTracking(finger: List<FingerBox>)
FingerBox
Parameter | Description |
---|---|
x Int | Coordinate of the left side of the rectangle top. |
y Int | Coordinate of the top of the rectangle right. |
width Int | Rectangle width. |
height Int | Rectangle height. |
previewWidth Int | Width of the preview. |
previewHeight Int | Height of the preview. |
orientation Int | Rectangle rotation value, in degrees. |
TorchListener
Returns TorchController that can be used to control the device torch.
Kotlin1fun onTorchControllerProvided(torchController: TorchController)
TorchController
Kotlin1interface TorchController {2 fun setTorch(torch: Torch)3 fun getTorch(): Torch4}
Torch
Type | Description |
---|---|
ON | Torch is on or will be turned on |
OFF | Torch is off or will be turned off. |
LatentResultListener
Returns information if capture succeeded or failed. In case of success, LatentSuccess will be returned in onSuccess callback, Error will be returned in onError otherwise.
Kotlin1interface TorchController {2 fun onSuccess(result: LatentSuccess)3 fun onError(error: Error)4}
LatentSuccess
Parameter | Description |
---|---|
image LatentImage | Contains image in PNG format with width and height. |
LatentImage
Parameter | Description |
---|---|
width Int | Image width. |
height Int | Image height. |
data ByteArray | PNG image. |
Errors
For every flow there is possibility to receive Error type of result. It means that something went wrong during the capture or backend communication. Fortunately, Error object contains a lot of useful information that help to handle failed flow.
Error
Parameter | Description |
---|---|
type ErrorType | Type of an error. High level information what goes wrong. Find types description below. |
code Int | Special code dedicated for particular case. Very helpful in L2, L3 troubleshooting. |
message String | Message with error description. |
ErrorType
Type | Description |
---|---|
TIMEOUT | Timeout occured during the flow. |
BAD_CAPTURE | Capture failed. Fingerprint was not detected or some kind of internal issue appeared. |
UNKNOWN | Unknow type of exception. Also used as default type for few cases. |
INVALID_LICENSE | License validation failed. Make sure that it has been activated with LicenseManager |
BioStore
The use of this component is optional. Its purpose is to allow the integrator to easily persist templates.
Query templates by userUUID
This lists the templates stored in the repository filtering by user.
Java1BioStoreDB.listTemplates(context, userId, new DataBaseAsyncCallbacks<List<IMorphoTemplate>>() {2 @Override3 public void onPreExecute() {4 // Optional hook on the builtin Android AsyncTask callback `onPreExecute`5 }67 @Override8 public void onSuccess(List<IMorphoTemplate> result) {9 //The list of templates that match the criteria.10 }1112 @Override13 public void onError(Exception e) {14 // An error has occurred.15 }16 });
Function
Java1public static void listTemplates(final Context context, final UUID userId, DataBaseAsyncCallbacks<List<IMorphoTemplate>> callbacks);
Parameter | Description |
---|---|
context Context | The Android context. |
userId UUID | The user identifier. |
callbacks DataBaseAsyncCallbacks | Callbacks to be executed depending on the result. |
Errors
You will receive an exception reporting the error.
Query templates by userUUID and modality
This lists the templates stored in the repository filtering by User
and BiometricModality
.
Java1BioStoreDB.listTemplates(context, userId, biometricModality, new DataBaseAsyncCallbacks<List<IMorphoTemplate>>() {2 @Override3 public void onPreExecute() {4 // Optional hook on the builtin Android AsyncTask callback `onPreExecute`5 }67 @Override8 public void onSuccess(List<IMorphoTemplate> result) {9 //The list of templates that match the criteria.10 }1112 @Override13 public void onError(Exception e) {14 // An error has occurred.15 }16 });
Function
Java1void listTemplates(final Context context, final UUID userId, final BiometricModality biometricModality, DataBaseAsyncCallbacks<List<IMorphoTemplate>> callbacks);
Parameter | Description |
---|---|
context Context | The Android context. |
userId UUID | The user id . |
biometricModality BiometricModality | The BiometricModality enum option. |
callbacks DataBaseAsyncCallbacks | Callbacks to be executed depending on the result. |
Errors
You will receive an exception reporting the error.
Add template
This stores a template in the repository. If there is a previous template with the same user UUID, Biometric location, and Biometric modality, it will be updated and the UUID returned.
Note: You cannot have two templates with the same configuration.
Java1BioStoreDB.addTemplate(context, morphoTemplate, new DataBaseAsyncCallbacks<UUID>() {2 @Override3 public void onPreExecute() {4 // Optional hook on the builtin Android AsyncTask callback `onPreExecute`5 }67 @Override8 public void onSuccess(UUID result) {9 //The template has been added and the template's uuid is returned as a parameter.10 }1112 @Override13 public void onError(Exception e) {14 // An error has occurred.15 }16 });
Function
Java1public static void addTemplate(final Context context, final IMorphoTemplate template, DataBaseAsyncCallbacks<UUID> callbacks);
Parameter | Description |
---|---|
context Context | The Android context. |
template IMorphoTemplate | The template to be stored. |
callbacks DataBaseAsyncCallbacks | Callbacks to be executed depending on the result. |
Errors
You will receive an exception reporting the error.
Update template
This updates a template in the repository.
Java1BioStoreDB.updateTemplate(context, morphoTemplate, new DataBaseAsyncCallbacks<Void>() {2 @Override3 public void onPreExecute() {4 // Optional hook on the builtin Android AsyncTask callback `onPreExecute`5 }67 @Override8 public void onSuccess(Void result) {9 //updated.10 }1112 @Override13 public void onError(Exception e) {14 // An error has occurred.15 }16});
Function
Java1void updateTemplate(final Context context, final IMorphoTemplate template, DataBaseAsyncCallbacks<Void> callbacks);
Parameter | Description |
---|---|
context Context | The Android context. |
template IMorphoTemplate | The template to be updated. |
callbacks DataBaseAsyncCallbacks | Callbacks to be executed depending on the result. |
Errors
You will receive an exception reporting the error.
Remove template
This removes a template from the repository.
Java1BioStoreDB.removeTemplate(context, templateId, new DataBaseAsyncCallbacks<Void>() {2 @Override3 public void onPreExecute() {4 // Optional hook on the builtin Android AsyncTask callback `onPreExecute`5 }67 @Override8 public void onSuccess(Void result) {9 //The template was removed.10 }1112 @Override13 public void onError(Exception e) {14 // An error has occurred.15 }16 });
Function
Java1void removeTemplate(final Context context, final UUID templateId, DataBaseAsyncCallbacks<Void> callbacks);
Parameter | Description |
---|---|
context Context | The Android context. |
templateId UUID | The template id to be removed. |
callbacks DataBaseAsyncCallbacks | Callbacks to be executed depending on the result. |
Errors
You will receive an exception reporting the error.
Remove templates associated to one userUUID
This removes the templates associated to the user identifier from the repository.
Java1BioStoreDB.removeTemplateByUserId(context, userId, new DataBaseAsyncCallbacks<Integer>() {2 @Override3 public void onPreExecute() {4 // Optional hook on the builtin Android AsyncTask callback `onPreExecute`5 }67 @Override8 public void onSuccess(Integer result) {9 //The number of templates removed.10 }1112 @Override13 public void onError(Exception e) {14 // An error has occurred.15 }16 });
Function
Java1void removeTemplateByUserId(final Context context, final UUID userId, DataBaseAsyncCallbacks<Integer> callbacks);
Parameter | Description |
---|---|
context Context | The Android context. |
userId UUID | The user id . |
callbacks DataBaseAsyncCallbacks | Callbacks to be executed depending on the result. |
Errors
You will receive an exception reporting the error.
Retrieve template
This retrieves a template from the database.
Java1BioStoreDB.getTemplate(context, templateId, new DataBaseAsyncCallbacks<IMorphoTemplate>() {2 @Override3 public void onPreExecute() {4 // Optional hook on the builtin Android AsyncTask callback `onPreExecute`5 }67 @Override8 public void onSuccess(IMorphoTemplate result) {9 //The template if exists.10 }1112 @Override13 public void onError(Exception e) {14 // An error has occurred.15 }16 });
Function
Java1void getTemplate(final Context context, final UUID templateId, DataBaseAsyncCallbacks<MorphoTemplate> callbacks);
Parameter | Description |
---|---|
context Context | The Android context. |
templateId UUID | The template id . |
callbacks DataBaseAsyncCallbacks | Callbacks to be executed depending on the result. |
Errors
You will receive an exception reporting the error.
Clear database
This clears all the data stored in the database.
Java1BioStoreDB.clear(context, new DataBaseAsyncCallbacks<Void>() {2 @Override3 public void onPreExecute () {4 // Optional hook on the builtin Android AsyncTask callback `onPreExecute`5 }67 @Override8 public void onSuccess (Void result){9 //Data has been cleared10 }1112 @Override13 public void onError (Exception e){14 // An error has occurred15 }16});
Function
Java1void clear(final Context context, DataBaseAsyncCallbacks<Void> callbacks);
Parameter | Description |
---|---|
context Context | The Android context. |
callbacks DataBaseAsyncCallbacks | Callbacks to be executed depending on the result. |
Errors
You will receive an exception reporting the error.
Add user
This adds a new user to the database.
Java1IUser user = new User();2 user.setName("Jose");3 BioStoreDB.addUser(context, user, new DataBaseAsyncCallbacks<UUID>() {4 @Override5 public void onPreExecute() {6 // Optional hook on the builtin Android AsyncTask callback `onPreExecute`7 }89 @Override10 public void onSuccess(UUID result) {11 //User saved12 }1314 @Override15 public void onError(Exception e) {16 // An error has occurred17 }18 });
Function
Java1void addUser(final Context context, final IUser user, DataBaseAsyncCallbacks<UUID> callbacks);
Parameter | Description |
---|---|
context Context | The Android context. |
user IUser | The user. |
callbacks DataBaseAsyncCallbacks | Callbacks to be executed depending on the result. |
Errors
You will receive an exception reporting the error.
Update user
This updates a user in the database.
Java1IUser user = ...//retrieve old user2 BioStoreDB.updateUser(context, user, new DataBaseAsyncCallbacks<Void>() {3 @Override4 public void onPreExecute() {5 // Optional hook on the builtin Android AsyncTask callback `onPreExecute`6 }78 @Override9 public void onSuccess(Void result) {10 //User updated.11 }1213 @Override14 public void onError(Exception e) {15 // An error has occurred.16 }17 });
Function
Java1void updateUser(final Context context, final IUser user, DataBaseAsyncCallbacks<Void> callbacks);
Parameter | Description |
---|---|
context Context | The Android context. |
user IUser | The user. |
callbacks DataBaseAsyncCallbacks | Callbacks to be executed depending on the result. |
Errors
You will receive an exception reporting the error.
Remove user
This removes a user from the database.
Java1BioStoreDB.removeUser(context, uuid, new DataBaseAsyncCallbacks<Void>() {2 @Override3 public void onPreExecute () {4 // Optional hook on the builtin Android AsyncTask callback `onPreExecute`5 }67 @Override8 public void onSuccess (Void result){9 //User removed10 }1112 @Override13 public void onError (Exception e){14 // An error has occurred15 }16});
Function
Java1void removeUser(final Context context, final UUID uuid, DataBaseAsyncCallbacks<Void> callbacks);
Parameter | Description |
---|---|
context Context | The Android context. |
uuid UUID | The user uuid . |
callbacks DataBaseAsyncCallbacks | Callbacks to be executed depending on the result. |
Errors
You will receive an exception reporting the error.
Get user
This retrieves a user from the database.
Java1BioStoreDB.getUser(context, uuid, new DataBaseAsyncCallbacks<IUser>() {2 @Override3 public void onPreExecute() {4 // Optional hook on the builtin Android AsyncTask callback `onPreExecute`5 }67 @Override8 public void onSuccess(IUser result) {9 //User10 }1112 @Override13 public void onError(Exception e) {14 // An error has occurred15 }16 });
Function
Java1void getUser(final Context context, final UUID uuid, DataBaseAsyncCallbacks<IUser> callbacks);
Parameter | Description |
---|---|
context Context | The Android context. |
uuid UUID | The user uuid . |
callbacks DataBaseAsyncCallbacks | Callbacks to be executed depending on the result. |
Errors
You will receive an exception reporting the error.
List users
List the users stored in the repository.
Java1BioStoreDB.listUsers(context, new DataBaseAsyncCallbacks<List<IUser>>() {2 @Override3 public void onPreExecute() {4 // Optional hook on the builtin Android AsyncTask callback `onPreExecute`5 }67 @Override8 public void onSuccess(List<IUser> result) {9 //Users10 }1112 @Override13 public void onError(Exception e) {14 // An error has occurred15 }16 });
Function
Java1void listUsers(final Context context, DataBaseAsyncCallbacks<List<IUser>> callbacks);
Parameter | Description |
---|---|
context Context | The Android context. |
callbacks DataBaseAsyncCallbacks | Callbacks to be executed depending on the result. |
Errors
You will receive an exception reporting the error.
Compression recommendations
Selfie images
- Recommended size is 400 px
- Recommended compression is JPEG90
- Size of image will be about 100 KB
Example code
Kotlin1val IMAGE_SIZE = 4002val JPEG_COMPRESSION_LEVEL = 9034private fun prepareImage(image:ByteArray):56ByteArray {7 val imageBitmap = BitmapFactory.decodeByteArray(image, 0, image.size)8 val scaledBitmap = Bitmap.createScaledBitmap(imageBitmap, IMAGE_SIZE, IMAGE_SIZE, true)9 imageBitmap.recycle()10 val byteArrayOutStream = ByteArrayOutputStream()11 val result = scaledBitmap.compress(Bitmap.CompressFormat.JPEG, JPEG_COMPRESSION_LEVEL, byteArrayOutStream)12 scaledBitmap.recycle()13 return byteArrayOutStream.toByteArray()14}