LogoLogo
Home
  • Youverify API Documentation
  • Getting Started
    • Getting your API Key
    • Getting your Public Merchant Key
    • Environment
    • Response Codes
  • Know Your Customer Services (KYC)
    • ID Document Verification (SDK)
      • Web SDK
      • iOS SDK
        • iOS Liveness SDK
        • iOS (Compat) Liveness SDK
        • iOS Document Capture SDK
      • Android SDK
        • Android Document Capture SDK
        • Android Liveness SDK
      • Document Capture Supported Countries
        • 🌏Asia
        • πŸ‡ͺπŸ‡ΊEurope
        • 🌎Latin America and the Caribbean
        • 🌍Middle East and Africa
        • 🌎North America
        • 🌏Oceania
    • ID Data Matching (eIDV)
      • 🌐Global
        • Supported Countries
      • πŸ‡ΏπŸ‡¦South Africa
        • Verify South African ID Number (SAID)
        • Verify South African Phone Number
        • Bank Account Verification
        • Proof of Address Verification
      • πŸ‡°πŸ‡ͺKenya
        • Verify International Passport
        • Verify Alien ID
        • Verify Drivers License
        • Verify Plate Number
        • Verify Collateral ID
        • Kenyan Bank Account Verification
          • Bank List
        • Credit History
        • Employment History
        • Verify Address Information
        • Verify Phone Number
        • Verify Identity Number
        • Verify Tax PIN
      • πŸ‡¬πŸ‡­Ghana
        • Verify International Passport
        • Verify Social Security and National Insurance Trust (SSNIT)
        • Verify Ghana Voters Card (GVC)
      • πŸ‡³πŸ‡¬Nigeria
        • Verify Bank Verification Number (BVN)
        • Verify Bank Verification Number (BVN Premium)
        • Verify Virtual National Identification Number (vNIN)
        • Verify National Identification Number (NIN)
        • Verify Nigerian Driver's License (Driver's License)
        • Advanced Phone Search
        • Verify Nigerian International Passport (Passport)
        • Verify Nigerian Permanent Voters Card (PVC)
        • Verify Phone Number
        • Individual Credit Report
        • Bank Account Verification
          • Basic Bank Account Verification
          • Bank List
            • Getting the list of Banks for Basic Bank Account
    • Facial Comparison
    • Retrieve an Identity
    • Identity History
  • Know Your Business Services (KYB)
    • 🌍Business Verification
    • 🌍Search for Businesses
    • Get Supported Countries and Regions
    • Retrieve Business details
    • Country-Specific KYB Services
      • πŸ‡³πŸ‡¬Nigeria
        • Tax Identification Number (TIN) Verification
      • πŸ‡ΏπŸ‡¦South Africa
        • Business Account Verification
        • Business Address Verification
  • Know Your Transaction Service (KYT)
    • Customer Management
      • Create an Individual Client
      • Create a Business Client
      • Initiate an Individual Client Assessment
      • Initiate an Business Client Assessment
      • Update a Client
      • Retrieve all Clients
      • Retrieve a Client
      • Delete a Client
    • Transaction Management
      • Create a Transaction
      • Retrieve an Evaluation
  • Risk Intelligence
    • Risk Intelligence: Initialise Risk Check
    • Retrieve Risk Intelligence Profile
    • Retrieve Risk Intelligence History
  • AML Services (Anti-Money Laundering)
    • PEP and Sanction Screening
      • Search using Name
        • Advanced Filters
      • Search using Identity
        • Advanced Filters
      • Search using Crypto
        • Advanced Filters
      • Retrieve a PEP and Sanction Screening Search
      • Screening Data Sources
      • Domestic PEP Search
    • Adverse Media Intelligence
    • Custom AML Watchlist
      • AML Watchlist (Sample list)
      • AML Watchlist Upload (Bulk Upload)
      • AML Watchlist Upload
      • Retrieve AML Watchlist
      • AML Watchlist Entity Update
      • AML Watchlist Entity Removal
  • Custom Workflow Builder (CWB)
    • CWB Webhook
    • CWB External API
      • Retrieve CWB History
      • Retrieve CWB Responses
      • Retrieve CWB Report
  • Youverify OS Error Codes
  • Webhooks
    • Know Your Customer Webhooks
      • Identity Verification
      • Address Verification
    • Know Your Transaction Webhooks
      • Customer Management Webhooks
        • Client Created
        • Client Updated
      • Alert Service Webhooks
        • Alert Created
        • Alert Triage Created
        • Alert Updated
      • Evaluation Webhooks
        • Evaluation Completed
        • Evaluation Started
        • Transaction Updated
  • Test Data
  • Our Legacy API and SDK
Powered by GitBook
On this page
  • Installation
  • Usage
  • Initializers
  • Tasks
  • Liveness Data
  • Credits

Was this helpful?

  1. Know Your Customer Services (KYC)
  2. ID Document Verification (SDK)
  3. Android SDK

Android Liveness SDK

Installation

To install, add the following line to your app's build.gradle file:

implementation("co.youverify:liveness-sdk-android:0.0.8'")

Add this configuration to your app module's build.gradle.kts file

defaultConfig {
    minSdk = 24
    targetSdk = 34
    ...
    ndk {
        abiFilters.addAll(listOf("armeabi-v7a", "arm64-v8a"))
    }
    ...
}

Usage

  1. Create a view model to initialize the package, here's a snippet:

private val androidSDK by viewModels<YVAndroidSDK>(factoryProducer = {
    return@viewModels object : ViewModelProvider.Factory {
        override fun <T : ViewModel> create(modelClass: Class<T>): T {
            return YVAndroidSDK(initializers) as T
        }
    }
})

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: Initializers

  1. Start the process, like below depending on what liveness requirement your project needs, use the liveness options like so.

    private fun startCompleteTheCircleTask() {
        androidSDK.start(tasks = listOf(
            CTCTaskOptions()
        )
        )
    }

    ...
  1. Start the UI, like so:

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
        ...
    setContent {
        YVLivenessTestTheme {
            Box(
                modifier = Modifier.fillMaxSize(),
                contentAlignment = Alignment.Center
            ) {
                Column {
                    Button(
                        onClick = { startCompleteTheCircleTask() },
                        shape = RoundedCornerShape(12.dp)

                    ) {
                        Text("Start Complete the Circle Task")
                    }
                        ......
                }

                androidSDK.StartUI()
            }
        }
    }
}

Full Example:

private val androidSDK by viewModels<YVAndroidSDK>(factoryProducer = {
    return@viewModels object : ViewModelProvider.Factory {
        override fun <T : ViewModel> create(modelClass: Class<T>): T {
            return YVAndroidSDK(
              publicKey = "MY_PUBLIC_KEY",
              ...,
              onSuccess = { data -> 
                // do something with data here
              }
            ) as T
        }
    }
})

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
        ........
}

Initializers

Option
Type
Required
Description
Default Value
Possible Values

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

publicKey

String

Yes

Your API key

-

Valid API Key

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

Option
Type
Required
Description
Default Value
Possible Values

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

Option
Type
Required
Description
Default Value
Possible Values

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

Option
Type
Required
Description
Default Value
Possible Values

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:

Option
Type
Description

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

PreviousAndroid Document Capture SDKNextDocument Capture Supported Countries

Last updated 1 month ago

Was this helpful?

This SDK is developed and maintained solely by

Youverify