DocumentDetector v8.x or above
Current Version
In upcoming releases, we'll update to the following versions:
Kotlin from 1.5.32 to 1.9.10
AGP: from 4.1.0 to 8.3.2
Gradle: from 6.9.1 to 8.4
Requirements
Minimum Android SDK API version:
minSdk 26
(Android 8 Oreo)Android SDK API version to compile:
compileSdk 34
Runtime permissions
SDK size
The SDK size is approximately 3.3 MB, which may decrease due to these elements.
Installation
If your version of Gradle is earlier than 7, add these lines to your build.gradle
.
If your version of Gradle is 7 or newer, add these lines to your settings.gradle
.
Add support for Java 8 (skip this code if Java 8 is enabled), Data Binding and TensorFlow Model to your build.gradle
file.
As our SDKs activities use Data Binding, it is required that you enable this setting within your app. The compileOptions
setting is required for SDK's built-in lambda functions, which were released in Java 8. The noCompress
setting tells the compiler not to compress files with the .tflite
extension used in the DocumentDetector.
Add the SDK version to the dependencies section in your build.gradle
file
Supported documents
Currently, supported documents are:
Instantiating the SDK
First things first, instantiate an object of type DocumentDetector
. This object will contain all your business rules for the SDK:
All parameters annotated with
@Nullable
can receivenull
values, useful if you want to configure only one of the parameters of the same method.
Builder method
DocumentDetectorStep
To create a capture flow, you will need to create an array of DocumentDetectorStep
, where each element will be a capture step. To construct each DocumentDetectorStep
object, you can enter the following elements:
CaptureStage
To improve the client's UX, we recommend creating difficulty stages for the DocumentDetector. For this, we offer the CaptureStage
object, where you can set the following parameters:
Since the .setCaptureStages
parameter is not required, if it is not used, the DocumentDetector
will use this default:
UploadSettings
To enable the document upload functionality it is necessary to instantiate an object of type UploadSettings(boolean enable) and set its parameters:
Currently, the supported file formats are:
MessageSettings
To use, simply instantiate a MessageSettings
object and use the methods as needed for customization.
Example
Security validations
We are constantly taking actions to make the product more and more secure, mitigating a number of attacks observed in the capture process and, consequently, reducing as many possible identity frauds as possible. The SDK has some blocks that may prevent its execution in certain contexts. To disable them, you can use the methods as shown in the example below:
Disabling security validations is recommended for testing purposes only. For publishing your application in production, we recommend using the default settings.
Starting Activity
After creating the DocumentDetector
, start the DocumentDetectorActivity
by passing this object as a parameter via extra intent:
Getting the result
To get the DocumentDetectorResult
object, which contains the captures taken by the SDK, override the onActivityResult
method in the same Activity that you started the DocumentDetectorActivity
:
DocumentDetectorResult
Capture
Last updated