Skip to main content

Android SDK

Getting Started

Latest release: Version 3.0.2

Requirements

Device Requirement

  • API level 21 (Android 5.0) or higher
  • Internet connection
  • Camera

Project Requirement

  • AndroidX Support

    • Facia SDK requires AndroidX 1.0.0 or later. If you haven't switched to AndroidX in your app yet then follow this guide.
  • Enable Java 8

    • Facia SDK requires Java 8 language features to be enabled in your project. If it is not already enabled, add this to your app/build.gradle file under the android section:
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
  • Enable ViewBinding
    • Facia SDK requires ViewBinding. If it is not already enabled, add this to your app/build.gradle file under the android section:
buildFeatures {
viewBinding true
}

Resources

Installation

Tip

It’s always recommended to use the updated version

Step 1: Go to root-level setting.gradle in your project and add the following:

setting.gradle
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' } // Add this line
}
}

OR

Go to project > android > build.gradle file and add the following

allprojects {
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' } // add this line
}
}

Step 2: In build.gradle(Module) add the following implementation

app/build.gradle
implementation 'com.github.FaciaMobile:android-core:3.0.2'

Basic Usage

Note

Make sure you have obtained authorization credentials before proceeding. You can get Login credentials (email & password) by contacting to Facia support team

Authorization

For authorization, Facia's SDKs require Access token. You can get access token from the API: https://app.facia.ai/backend/api/transaction/get-access-token/

Request Object

ParametersDescription
emailRequired: Yes
Type: String
passwordRequired: Yes
Type: String

Configuration

The Facia’s mobile SDKs can be configured on the basis of parameters provided in the config object. The details of parameters can be found here.

JSONObject config=new JSONObject();
config.put("showConsent",true);
config.put("showVerificationType",true);
config.put("showResult",true);

Initialisation

Facia’s mobile SDK can be initialised by using the given method and passing token, activity instance, config object and callback listener as the parameters.

FaciaAi faciaAi = new FaciaAi();
faciaAi.createRequest("ACCESS_TOKEN", parentActivity, config, new RequestListener() {
@Override
public void requestStatus(HashMap<String, String> responseSet) {
//responseSet will return response of the request
Log.e("Response",responseSet.toString());
}
});

Callbacks

The SDK receive callbacks on termination, whether after the request completion or if the journey is left mid-way. The callbacks are received as

 new RequestListener() {
@Override
public void requestStatus(HashMap<String, String> responseSet) {
// Handle callback responses here
}
}

The complete list of callback events can be found here.

Callback Handling

All the callbacks can be handled inside the client’s calling activity. The responses and callback handling can be seen below.

On SDK Completion

3D Liveness

if(responseSet.get("event").equalsIgnoreCase("verification.accepted")){
// Verification accepted callback
}
else if(responseSet.get("event").equalsIgnoreCase("verification.declined")){
// Verification declined callback
}

Photo ID Match

if(responseSet.get("event").equalsIgnoreCase("photo_id.match_success")){
// Verification accepted callback
}
else if(responseSet.get("event").equalsIgnoreCase("photo_id.match_failure")){
// Verification declined callback
}

On SDK Error

if(responseSet.get("event").equalsIgnoreCase("permission.denied")){
// This callback is returned in case the permissions are declined by the end user.
}
else if(responseSet.get("event").equalsIgnoreCase("request.timeout")){
// This callback is returned in case request took too long and is timed out
}
else if(responseSet.get("event").equalsIgnoreCase("request.cancelled")){
// This callback is returned when verification is cancelled midway by the end user
}
else if(responseSet.get("event").equalsIgnoreCase("error.occurred")){
// This callback is returned if the API request faces any issue
}
else if(responseSet.get("event").equalsIgnoreCase("emulator.detected")){
// This callback is returned if the SDK is running on an emulator
}
else {
// Some error has been occured during the verification process
}

Customisation

Facia supports a set of customisation options that will influence the appearance of the mobile SDK.

Colours

The colour of buttons and font can be customised by overriding the values of following variables in the project's color.xml file.

<color name="dark_text_color">#424242</color>
<color name="light_text_color">#9E9E9E</color>
<color name="face_detected_oval_color">#4E836C</color>
<color name="face_not_detected_oval_color">#F4495D</color>
<color name="dialog_button_text_color">#173DD0</color>
<color name="button_bg_color">#173DD0</color>
<color name="button_text_color">#FFFFFFFF</color>
<color name="ql_instruction_bg_color">#FFFFFFFF</color>

Changelog

DateSDK VersionsChanges
Mar 26, 20243.0.2Update Depedencies.
Mar 13, 20243.0.1Minor Tweaks.
Feb 23, 20242.0.6Improve instructions flow.
Feb 15, 20242.0.5Improved user experience.
Jan 26, 20242.0.4Improved Camera functionalities.
Nov 27, 20231.1.1Improved design & Liveness flow.
Nov 17, 20231.0.9Improved Passive Liveness flow & design.
Oct 19, 20231.0.33D Liveness & Photo ID Match features are added.