VerID

Package com.appliedrec.ver_id

public class VerID

Methods

isLoaded

Introduced in version 1.6

public isLoaded()

This method replaces the static isLoaded() method from version 1.0.

Returns

boolean
true if Ver-ID has been loaded and is ready to use.

See also

getLoadException

Introduced in version 2.0.2

public getLoadException()

Returns

java.lang.Exception
Exception that was thrown during the Ver-ID load operation or null if Ver-ID is not loaded or loading did not fail.

load

Introduced in version 3.0

public load(Context, String, URL, boolean, VerID.LoadCallback)

Load Ver-ID. You must call this method or load(Context,LoadCallback) before starting a registration or authentication session.

Parameters

context android.content.Context
apiSecret java.lang.String
Your API secret or null if you set the secret in your app's manifest: <meta-data android:name="com.appliedrec.verid.apiSecret" android:value="yourApiSecret" />
resourcesURL java.net.URL
URL from which Ver-ID will download the library resources. You may set this to null and place the resources in an VerIDModels folder in your app's assets or set the URL as string in your app's manifest: <meta-data android:name="com.appliedrec.verid.resourcesURL" android:value="resources URL" />
clearDatabase boolean
callback com.appliedrec.ver_id.VerID.LoadCallback

load

Introduced in version 1.6

public load(Context, String, VerID.LoadCallback)

Load Ver-ID. You must call this method or load(Context,LoadCallback) before starting a registration or authentication session.

Parameters

context android.content.Context
apiSecret java.lang.String
Your API secret or null if you set the secret in your app's manifest: <meta-data android:name="com.appliedrec.verid.apiSecret" android:value="yourApiSecret" />
callback com.appliedrec.ver_id.VerID.LoadCallback

See also

load

Introduced in version 1.0

public load(Context, String, boolean, VerID.LoadCallback)

Parameters

context android.content.Context
apiSecret java.lang.String
clearDatabase boolean
callback com.appliedrec.ver_id.VerID.LoadCallback

load

Introduced in version 1.6

public load(Context, VerID.LoadCallback)

Load Ver-ID. You must call this method or load(Context,String,LoadCallback) before starting a registration or authentication session. Set your API secret in your app's manifest: <meta-data android:name="com.appliedrec.verid.apiSecret" android:value="yourApiSecret" />

Parameters

context android.content.Context
callback com.appliedrec.ver_id.VerID.LoadCallback

See also

load

Introduced in version 2.0.2

public load(Context, String)

Same as load(Context,String,URL,boolean) with resources URL set to null

Parameters

context android.content.Context
Your app's context
apiSecret java.lang.String
Your API secret or null if you set the secret in your app's manifest: <meta-data android:name="com.appliedrec.verid.apiSecret" android:value="yourApiSecret" />

load

Introduced in version 2.0.2

public load(Context)

Same as load(Context,String,URL,boolean) with API secret and resources URL set to null

Parameters

context android.content.Context
Your app's context

load

Introduced in version 3.0

public load(Context, String, URL, boolean)

Load Ver-ID. If you are using intents to launch Ver-ID activities or Ver-ID loaders this method is called implicitly.

Parameters

context android.content.Context
apiSecret java.lang.String
Your API secret or null if you set the secret in your app's manifest: <meta-data android:name="com.appliedrec.verid.apiSecret" android:value="yourApiSecret" />
resourcesURL java.net.URL
URL from which Ver-ID will download the library resources. You may set this to null and place the resources in an VerIDModels folder in your app's assets or set the URL as string in your app's manifest: <meta-data android:name="com.appliedrec.verid.resourcesURL" android:value="resources URL" />
clearDatabase boolean

unload

Introduced in version 1.6

public unload()

Unload Ver-ID and release its resources. You must call load(Context, String, LoadCallback) again prior to calling any Ver-ID methods. This method replaces the static unload() method from version 1.0.

See also

unload

Introduced in version 4.4.0

public unload(VerID.UnloadCallback)

Same as unload() but executes a callback function onUnloaded() on the supplied UnloadCallback object when the unloading finishes.

Parameters

callback com.appliedrec.ver_id.VerID.UnloadCallback

isAuthorized

Introduced in version 1.6

Deprecated in 1.8.1

public isAuthorized()

This method replaces the static isAuthorized() method from version 1.4.

Returns

boolean
true if the app is authorized to use the Ver-ID SDK. Call com.appliedrec.ver_id.VerID.html#load(Context, String, LoadCallback) with your API secret to authenticate your app.

See also

getContext

Introduced in version 1.0

public getContext()

Context that was passed to the com.appliedrec.ver_id.VerID.html#load(Context, String, LoadCallback) load} method

Returns

android.content.Context
Context

isUserRegistered

Introduced in version 1.6

public isUserRegistered(String)

Check whether a user with the given id has been registered. Ver-ID registers a user when it gathers enough templates to perform face recognition. This method replaces the static method isUserRegistered(String) from version 1.0. You must first load Ver-ID and call this method on a worker thread. Consider loading an array of all users using com.appliedrec.ver_id.loaders.VerIDUsersLoader.html.

Parameters

userId java.lang.String
The id of the user

Returns

boolean
true if the user is registered

Throws

java.lang.Exception

getUserProfilePicture

Introduced in version 1.6

public getUserProfilePicture(String)

Get a picture of the user that can be used as a profile photo. The picture is collected at registration. This method replaces the static getUserProfilePicture(String) method from version 1.0. You must first load Ver-ID and call this method on a worker thread. Consider using VerIDUserPictureUriLoader instead.

Parameters

userId java.lang.String
ID of the user whose profile photo to load

Returns

android.graphics.Bitmap
Image of the user's face

See also

getUserProfilePictureUri

Introduced in version 1.8

public getUserProfilePictureUri(String)

Return a profile photo URI for the user specified by the userId. You must first load Ver-ID and call this method on a worker thread. Consider using VerIDUserPictureUriLoader instead.

Parameters

userId java.lang.String
The ID of the user for whom to get the profile photo URI

Returns

android.net.Uri
Profile photo URI (use content resolver to read the file)

See also

deregisterUser

Introduced in version 1.6

public deregisterUser(String)

Deregister the user and delete the associated account. Subsequent attempts to authenticate as this user will fail. This method replaces the static method deregisterUser(String) from version 1.0.

Parameters

userId java.lang.String
The user to deregister

Throws

java.lang.Exception
If Ver-ID has not been initialized

getRegisteredUsers

Introduced in version 1.6

public getRegisteredUsers()

Get the list of user ids of users who have registered their faces on this device. This method replaces the static getRegisteredUsers() method from version 1.0.

Returns

java.lang.String[]
List of user ids

Throws

java.lang.Exception
If Ver-ID is not initialized or on a database error

See also

getRegisteredUserBearings

Introduced in version 1.6

public getRegisteredUserBearings(String)

This method replaces the static getRegisteredUserBearings(String) method from version 1.0.

Parameters

userId java.lang.String
ID of the user to query

Returns

java.util.EnumSet<Bearing>
Bearings registered for the user with the given ID

Throws

java.lang.Exception

getRegisteredVerIDUsers

Introduced in version 1.6

public getRegisteredVerIDUsers()

This method replaces the static getRegisteredVerIDUsers() method from version 1.0. You must call this on a worker thread. Consider using VerIDUsersLoader instead.

Returns

com.appliedrec.ver_id.model.VerIDUser[]
Registered users

Throws

java.lang.Exception

See also

isUserBearingRegistered

Introduced in version 1.6

public isUserBearingRegistered(String, VerID.Bearing)

This method replaces the static isUserBearingRegistered(String, Bearing) method from version 1.0.

Parameters

userId java.lang.String
bearing com.appliedrec.ver_id.VerID.Bearing

Returns

boolean
true if the user has registered the given bearing

Throws

java.lang.Exception

canUserAuthenticateWithSettings

Introduced in version 1.8

public canUserAuthenticateWithSettings(String, VerIDAuthenticationSessionSettings)

Indicates whether the user can run an authentication with the given settings If the method returns false you will need to register extra faces for the user by running a registration session with settings where the LivenessDetection level is set to STRICT.

Parameters

userId java.lang.String
The ID of the user to be authenticated
settings com.appliedrec.ver_id.session.VerIDAuthenticationSessionSettings
The settings that will be passed to the authentication activity

Returns

boolean
true if the user can authenticate with the given settings

Throws

java.lang.Exception

findFaceInImage

Introduced in version 1.6.2

public findFaceInImage(String)

Find a face in an image. Ver-ID must be loaded prior to calling this method.

Parameters

filePath java.lang.String
The path to the image file

Returns

com.appliedrec.ver_id.model.VerIDFace
Detected face or null if not face found

Throws

java.lang.Exception
If face detection fails or Ver-ID is not loaded

detectFaceInImage

Introduced in version 2.0.3

public detectFaceInImage(Bitmap, boolean, boolean)

Detect a face in image. This is a blocking call. Execute it on a worker thread.

Parameters

image android.graphics.Bitmap
The bitmap in which to find the face. The bitmap must not be rotated.
keepForRecognition boolean
Set to {@code false} unless you are planning to use the face for operations that require face recognition like registration or authentication.
strictBearingMatching boolean
Set to `true` if you anticipate using the face for face recognition where the face must match the bearing of the registered face. This is used for example in sessions that use {@link VerID.LivenessDetection#STRICT strict liveness detection level}.

Returns

com.appliedrec.ver_id.model.VerIDFace
Face detected in the image

Throws

java.lang.Exception
If the call fails or no suitable face is detected in the image

detectFaceInImage

Introduced in version 2.0.3

public detectFaceInImage(Bitmap, boolean, boolean, VerID.VerIDTaskCallback)

Detect a face in image. This is an asynchronous call that invokes a callback on completion.

Parameters

image android.graphics.Bitmap
The bitmap in which to find the face. The bitmap must not be rotated.
keepForRecognition boolean
Set to {@code false} unless you are planning to use the face for operations that require face recognition like registration or authentication.
strictBearingMatching boolean
Set to `true` if you anticipate using the face for face recognition where the face must match the bearing of the registered face. This is used for example in sessions that use {@link VerID.LivenessDetection#STRICT strict liveness detection level}.
callback com.appliedrec.ver_id.VerID.VerIDTaskCallback<VerIDFace>
Callback invoked on completion

registerFacesAsUser

Introduced in version 2.0.3

public registerFacesAsUser(VerIDFace[], String, boolean)

Register faces as user. This is a blocking call. Execute it on a worker thread.

Parameters

faces com.appliedrec.ver_id.model.VerIDFace[]
Faces to register. Must be suitable for recognition
userId java.lang.String
ID of the user to register in the faces
append boolean
True to append the faces if the user already exists. False will delete the user first

Returns

com.appliedrec.ver_id.model.VerIDUser
The registered user

Throws

java.lang.Exception
if the registration fails

registerFacesAsUser

Introduced in version 2.0.3

public registerFacesAsUser(VerIDFace[], String, boolean, VerID.VerIDTaskCallback)

Register faces as user. This is an asynchronous call that invokes a callback on completion.

Parameters

faces com.appliedrec.ver_id.model.VerIDFace[]
Faces to register. Must be suitable for recognition
userId java.lang.String
ID of the user to register in the faces
append boolean
True to append the faces if the user already exists. False will delete the user first
callback com.appliedrec.ver_id.VerID.VerIDTaskCallback<VerIDUser>
Callback invoked on completion

authenticateUserInFaces

Introduced in version 2.0.3

public authenticateUserInFaces(String, VerIDFace[], boolean)

Authenticate user in faces. This is a blocking call. Execute it on a worker thread.

Parameters

userId java.lang.String
ID of the user to authenticate
faces com.appliedrec.ver_id.model.VerIDFace[]
Faces in which to authenticate the user. Must be suitable for recognition
strictBearingMatching boolean
{@code true} to make the bearing detected in the faces match exactly the registered face bearing. Setting this to {@code true} assumes that the user registered a face with the bearing in a {@link com.appliedrec.ver_id.session.VerIDRegistrationSessionSettings session} where {@link com.appliedrec.ver_id.session.VerIDRegistrationSessionSettings#livenessDetection livenessDetection} was set to {@link LivenessDetection#STRICT strict}. Otherwise the call throws an error.

Returns

java.lang.Boolean
true if the user has been authenticated in at least one of the faces

Throws

java.lang.Exception
if the authentication fails

authenticateUserInFaces

Introduced in version 2.0.3

public authenticateUserInFaces(String, VerIDFace[], boolean, VerID.VerIDTaskCallback)

Authenticate user in faces. This is an asynchronous call that invokes a callback on completion.

Parameters

userId java.lang.String
ID of the user to authenticate
faces com.appliedrec.ver_id.model.VerIDFace[]
Faces in which to authenticate the user. Must be suitable for recognition
strictBearingMatching boolean
{@code true} to make the bearing detected in the faces match exactly the registered face bearing. Setting this to {@code true} assumes that the user registered a face with the bearing in a {@link com.appliedrec.ver_id.session.VerIDRegistrationSessionSettings session} where {@link com.appliedrec.ver_id.session.VerIDRegistrationSessionSettings#livenessDetection livenessDetection} was set to {@link LivenessDetection#STRICT strict}. Otherwise the callback returns an error.
callback com.appliedrec.ver_id.VerID.VerIDTaskCallback<Boolean>
Callback invoked on completion

discardFaces

Introduced in version 1.0

public discardFaces(VerIDFace[])

Discard faces when they're no longer needed for recognition

Parameters

faces com.appliedrec.ver_id.model.VerIDFace[]
Faces to discard

getSecurityLevel

Introduced in version 1.6

public getSecurityLevel()

Get the security level setting. This method replaces the static getSecurityLevel() method from version 1.1.

Returns

com.appliedrec.ver_id.VerID.SecurityLevel
Security level or null if Ver-ID has not been loaded and security level has not been set using setSecurityLevel.

See also

setSecurityLevel

Introduced in version 1.6

public setSecurityLevel(VerID.SecurityLevel)

Set Ver-ID security level. This method replaces the static setSecurityLevel(SecurityLevel) method from version 1.1.

Parameters

level com.appliedrec.ver_id.VerID.SecurityLevel
new security level setting

See also

compareFacesInImages

Introduced in version 1.6.6

2.0.2 Deprecated

public compareFacesInImages(Bitmap, Bitmap)

Compare faces in two images Must NOT be run on the application's main (UI) thread.

Parameters

image1 android.graphics.Bitmap
image2 android.graphics.Bitmap

Returns

double
Similarity score between 0 (least similar) and 100 (most similar)

Throws

java.lang.Exception

See also

setLogEnabled

Introduced in version 1.8

Deprecated in 4.0.0

public setLogEnabled(boolean)

Enable or disable logging

Parameters

enabled boolean
true to enable log

getLogEnabled

Introduced in version 1.8

Deprecated in 4.0.0

public getLogEnabled()

Indicates whether logging is enabled

Returns

boolean
true if log is enabled

setLogger

Introduced in version 1.8

Deprecated in 4.0.0

public setLogger(ILogger)

Sets the logger that will receive log events

Parameters

logger com.appliedrec.ver_id.util.ILogger
Instance of a class that implements the {@link ILogger ILogger} interface

getLogger

Introduced in version 1.8

Deprecated in 4.0.0

public getLogger()

Get event logger

Returns

com.appliedrec.ver_id.util.ILogger
An object that receives log events or null if none is set

setLogSubmitter

Introduced in version 1.8

Deprecated in 4.0.0

public setLogSubmitter(ILogSubmitter)

Sets the submitter that will be used when submitting logs using the submitLog method

Parameters

submitter com.appliedrec.ver_id.util.ILogSubmitter

hasLogSubmitter

Introduced in version 1.8

Deprecated in 4.0.0

public hasLogSubmitter()

Indicates whether a log submitter has been set

Returns

boolean
true if log submitter has been set

submitLog

Introduced in version 1.0

Deprecated in 4.0.0

public submitLog(VerID.LogSubmitterListener, ILogger.EventType...)

Submit debug logs. This method will submit logs with the specified event types using the log submitter

Parameters

submitterListener com.appliedrec.ver_id.VerID.LogSubmitterListener
Listener that will receive a callback when the logs have been submitted
eventTypes com.appliedrec.ver_id.util.ILogger.EventType[]
Event types to submit

isLogEmpty

Introduced in version 1.8

Deprecated in 4.0.0

public isLogEmpty(ILogger.EventType...)

Indicates whether a log is empty. You may call this to find out whether submitLog will have an effect

Parameters

eventTypes com.appliedrec.ver_id.util.ILogger.EventType[]
Event types to check for. Considers all entries if no event types are specified.

Returns

boolean
true if log is empty

clearLog

Introduced in version 1.8

Deprecated in 4.0.0

public clearLog()

Deletes all debug output

getVersion

Introduced in version 4.4.0

public static getVersion()

Get version of the Ver-ID library

Returns

java.lang.String
Version number in the format major.minor.patch.

Properties

shared

Introduced in version 1.6

public static final VerID shared

Shared instance of Ver-ID