Android SDK
The SDK provides a set of screens for capturing identity documents, face photos, and profile data, and for performing the liveness check.
The SDK does not provide methods for obtaining verification results. You can either use the API to pull the results or rely on webhooks from the GetID backoffice.
Getting started
Requirements
- Android studio 3.5+
- Android SDK version 21+
Obtaining an SDK key
In order to start using the Native SDK, you will need an SDK KEY
and API URL
.
Both will be provided by Checkin.com during the implementation.
Installation
To install the Android SDK, add the repository https://cdn.getid.cloud/sdk/android to your build definition.
repositories {
mavenCentral()
maven { url "https://jitpack.io" }
maven { url "https://cdn.getid.cloud/sdk/android" }
}
dependencies {
implementation "ee.getid:getidlib:3.x.y"
}
Permissions
The following permissions need to be granted:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
There is also the CAMERA
permission, but this will be prompted to the user during runtime.
Usage
Starting the flow
There are two ways to start the verification flow: using the SDK KEY
or using a JWT
. We recommend using JWT in the production environment. But during the development, you can use SDK KEY
, because it's a little bit more convenient.
Then call GetIDSDK().startVerificationFlow()
method from the place in your code that responds to starting the verification flow. For example, it can be a handler of a button touch event.
GetIDSDK().startVerificationFlow(
context = applicationContext,
apiUrl = "API_URL",
auth = Key("SDK_KEY"),
flowName = "FlowName"
)
new GetIDSDK().startVerificationFlow(
getApplicationContext(),
"API_URL",
new Key("SDK_KEY", null),
"FlowName",
null,
null,
null,
null
);
To start the verification flow use a JWT
, your app should obtain the token from your backend.
Your backend should have the SDK KEY
to request the token. Don't store SDK KEY
inside the app in the production environment.
To test starting the flow using a JWT
, you can obtain one. To obtain a JWT
make a POST request on your API URL
with SDK KEY
in the header:
$ curl -H "Content-Type: application/json" -H "x-sdk-key: SDK_KEY" -X POST API_URL/sdk/v2/token
Then pass the received token to theGetIDSDK().startVerificationFlow()
method:
GetIDSDK().startVerificationFlow(
context = applicationContext,
apiUrl = "API_URL",
auth = Token("JWT"),
flowName = "FlowName"
)
new GetIDSDK().startVerificationFlow(
getApplicationContext(),
"API_URL",
new Token("JWT"),
"FlowName",
null,
null,
null,
null
);
Locale
By default, the SDK gets the list of the device's preferred languages and chooses the best match from the list of supported languages. So you don't have to set up the language of the verification flow's UI.
But if you want to override the default behavior by some reason, then pass locale
to GetIDSDK().startVerificationFlow()
method.
GetIDSDK().startVerificationFlow(
context = applicationContext,
apiUrl = "API_URL",
auth = Token("JWT"),
flowName = "FlowName",
locale = "en"
)
new GetIDSDK().startVerificationFlow(
getApplicationContext(),
"API_URL",
new Token("JWT"),
"FlowName",
null,
"en",
null,
null
);
Handling callbacks
If you want to handle the verification process completion then pass eventListener
to GetIDSDK().startVerificationFlow()
method.
Callback | Description |
---|---|
verificationFlowStart() | Tells the callback that the verification flow has been successfully started. |
verificationFlowComplete(...) | Tells the callback that the user has completed the verification flow. The applicationId property of application parameter can be used for getting the verification status. |
verificationFlowCancel() | Tells the callback that the user has cancelled the verification flow. |
verificationFlowFail(...) | Tells the callback that the verification flow has been failed. |
Here is an example of handling the SDK callbacks:
GetIDSDK().startVerificationFlow(
context = applicationContext,
apiUrl = "API_URL",
auth = Token("JWT"),
flowName = "FlowName",
locale = "en"
)
private fun initEventListeners() = object : BroadcastReceiverListener {
override fun verificationFlowStart() {
Log.d("GetIdTag", "GetID flow has been started.")
}
override fun verificationFlowCancel() {
Log.d("GetIdTag", "GetID flow has been cancelled.")
}
override fun verificationFlowFail(error: GetIDError) {
Log.d("GetIdTag", "GetID flow has been completed with error:" + error.name)
}
override fun verificationFlowComplete(application: GetIDApplication) {
Log.d("GetIdTag", "GetID flow has been completed, applicationId:" + application.applicationId)
}
}
Possible errors
Errors that can occur in SDK are GetIDError enum, see the list of all possible cases in the tables below.
GetIDError | Description |
---|---|
INVALID_KEY | Invalid SDK_KEY . |
INVALID_TOKEN | Invalid JWT . Maybe, it has been expired. |
FLOW_NOT_FOUND | There is no flow with the name you passed as flowName . See all the possible names in GetID Dashboard, at the Flows tab. |
UNSUPPORTED_SCHEMA_VERSION | It means that the SDK version is outdated. Note: schemaVersion != sdkVersion . |
CUSTOMER_ID_ALREADY_EXIST | An application with this customerId already exists. |
TOKEN_EXPIRED | The token has been expired. |
DENY_PERMISSION | Permission has been rejected. |
UNSUPPORTED_LIVENESS_VERSION | It means that the SDK version is outdated. |
INVALID_LIVENESS_TOKEN | Invalid token for liveness. |
FAILED_TO_SEND_APPLICATION | The SDK failed to send the captured data to the server (because of an network error, for example). |
UNEXPECTED_ERROR | Other errors. |
Updated 17 days ago