Android SDK
Getting Started
Latest release: Version 3.0.7
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
- Integration Sample: Android Sample App
Installation
It’s always recommended to use the updated version
Step 1: Go to root-level setting.gradle in your project and add the following:
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
implementation 'com.github.FaciaMobile:android-core:3.0.7'
Basic Usage
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
Parameters | Description |
---|---|
Required: Yes Type: String | |
password | Required: 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.
- Java
- Kotlin
JSONObject config=new JSONObject();
config.put("showConsent",true);
config.put("showVerificationType",true);
config.put("showResult",true);
val config = JSONObject().apply{
put("showConsent", true)
put("showVerificationType", true)
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.
- Java
- Kotlin
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());
}
});
val faciaAi = FaciaAi()
faciaAi.createRequest("ACCESS_TOKEN", parentActivity, config) { responseSet ->
Toast.makeText(this, responseSet.toString(), Toast.LENGTH_LONG).show()
}
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
- Java
- Kotlin
new RequestListener() {
@Override
public void requestStatus(HashMap<String, String> responseSet) {
// Handle callback responses here
}
}
responseSet ->
Toast.makeText(this, responseSet.toString(), Toast.LENGTH_LONG).show()
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
- Java
- Kotlin
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
}
3D Liveness
when (responseSet["event"])
{
"verification.accepted" -> Log.i("Response","accepted") // Verification accepted callback
"verification.declined" -> Log.i("Response","declined") // Verification declined callback
}
Photo ID Match
when (responseSet["event"])
{
"photo_id.match_success" -> Log.i("Response","photo id matched") // Verification accepted callback
"photo_id.match_failure" -> Log.i("Response","photo id not matched") // Verification declined callback
}
On SDK Error
- Java
- Kotlin
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
}
when (responseSet["event"])
{
"permission.denied" -> Log.i("Response","permission denied") // This callback is returned in case the permissions are declined by the end user.
"request.timeout" -> Log.i("Response","timeout") // This callback is returned in case request took too long and is timed out
"request.cancelled" -> Log.i("Response","request cancelled") // This callback is returned when verification is cancelled midway by the end user
"error.occurred" -> Log.i("Response","error occurred") // This callback is returned if the API request faces any issue
"emulator.detected" -> Log.i("Response","emulator detected") // This callback is returned if the SDK is running on an emulator
else -> Log.i("Response", "error") // 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>
SDK Size
The complete size of Facia's android SDK is 12.9 MB.
Changelog
Date | SDK Versions | Changes |
---|---|---|
Dec 17, 2024 | 3.0.7 | Update Depedencies. |
Aug 30, 2024 | 3.0.6 | Minor Tweaks. |
Jun 21, 2024 | 3.0.4 | Features improvement. |
Mar 26, 2024 | 3.0.2 | Update Depedencies. |
Mar 13, 2024 | 3.0.1 | Minor Tweaks. |
Feb 23, 2024 | 2.0.6 | Improve instructions flow. |
Feb 15, 2024 | 2.0.5 | Improved user experience. |
Jan 26, 2024 | 2.0.4 | Improved Camera functionalities. |
Nov 27, 2023 | 1.1.1 | Improved design & Liveness flow. |
Nov 17, 2023 | 1.0.9 | Improved Passive Liveness flow & design. |
Oct 19, 2023 | 1.0.3 | 3D Liveness & Photo ID Match features are added. |