Youverify Liveness Android SDK
Software Development Kit for Youverify's Liveness Check
Installation
To install, add the following line to your app's build.gradle
file:
Add this configuration to your app module's build.gradle.kts
file
Usage
Create a view model to initialize the package, here's a snippet:
where initializers
are the parameters you will be passing into the SDK, such as a collection of tasks.
For a list of the valid options, check this out
Start the process, like so:
This could also be called with an array of tasks represented as TaskProperties
. The supplied tasks override those provided during initialization.
Start the UI, like so:
Full Example:
Initializers
sandboxEnvironment
Boolean
No
Sets whether session should run in sandbox or live mode
true
true
, false
tasks
List
No
Sets tasks that need to be performed for liveness to be confirmed
null
See tasks
user
SDKUser
No
Sets details of user for which liveness check is being performed
null
See nested options below
user.firstName
String
Yes
First name of user
-
Any string
user.lastName
String
No
Last name of user
null
Any string
user.email
String
No
Email of user
null
Any string
branding
Branding
No
Customizes UI to fit your brand
null
See nested options below
branding.color
String
No
Sets your branding color
null
Valid hex or RGB string
branding.logo
String
No
Sets your logo
null
Valid image link
onClose
Function
No
Callback function that gets triggered when modal is closed
null
Any valid function
onSuccess
Function
No
Callback function that gets triggered when all tasks have been completed and passed. Called with completion data
null
Any valid function
onFailure
Function
No
Callback function that gets triggered when at least one task fails. Called with completion data
null
Any valid function
Tasks
A task is a series of instructions for users to follow to confirm liveness. Find below a list of tasks.
PS: We aim to frequently add to this list a variety of fun and yet intuitive ways of confirming liveness, so be on the lookout for more tasks!
Complete The Circle
User passes task by completing imaginary circle with head movement.
CTCTaskOptions
task
Task
Yes
Id of task
-
Task.COMPLETE_THE_CIRCLE
difficulty
TaskDifficulty
No
Sets difficulty of task
TaskDifficulty.Medium
.Easy, .Medium, .Hard
timeout
Long
No
Sets time in milliseconds after which task automatically fails
20000L
Any number in milliseconds(Long)
Yes Or No
User passes task by answering a list of arbitrary questions set by you with the tilting of the head; right for a yes
and left for a no
.
YesOrNoTaskOptions
task
Task
Yes
Id of task
-
Task.YES_OR_NO
difficulty
TaskDifficulty
No
Sets difficulty of task
TaskDifficulty.Medium
.Easy, .Medium, .Hard
timeout
Long
No
Sets time in milliseconds after which task automatically fails
20000L
Any number in milliseconds(Long)
questions
List
No
A set of questions to ask user
null
See nested options below
questions.question
String
Yes
Question to ask user. Should be a true
or false
type question. Eg: "Are you ready"
-
Any string
questions.answer
Boolean
Yes
Answer to the question
-
true
, false
questions.errorMessage
String
No
Error message to display if user gets question wrong
undefined
Any string
Motions
User passes task by performing random motions in random sequences, which include nodding
, blinking
and opening of mouth
.
MotionTaskOptions
task
Task
Yes
Id of task
-
Task.MOTIONS
difficulty
TaskDifficulty
No
Sets difficulty of task
TaskDifficulty.Medium
.Easy, .Medium, .Hard
timeout
Long
No
Sets time in milliseconds after which task automatically fails
20000L
Any number in milliseconds(Long)
maxNods
Int
No
Maximum amount of nods a user is asked to perform
5
Any integer
maxBlinks
Int
No
Maximum amount of nods a user is asked to perform
5
Any integer
Liveness Data
The onSuccess
and onFailure
callbacks (if supplied) are passed the following data:
data
LivenessData
Data passed through callback
data.faceImage
String
Face Image of user performing liveness check
data.livenessClip
String
Video of user performing liveness check
data.passed
Boolean
Indicator on whether liveness check passed or failed
data.metadata
Map<String, Any>
Metadata passed in during initialization
Credits
This SDK is developed and maintained solely by Youverify
Last updated
Was this helpful?