# ID Card Recognition SDK - Android

## Features

* [x] Support ID documents from 200+ countries
* [x] Document Detection
* [x] Recognition of ID Cards, Passports, Driver's Licenses
* [x] MRZ and Barcode Recognition
* [x] Document Image Extraction
* [x] Portrait Image Extraction
* [x] 130+ languages, by including Greek, Arabic, Latin, Cyrillic, Hebrew, Chinese, and more
* [x] Fully-Offline Works and On-Premise

## License

We offer `lifetime license(perpetual license)` tied to each  `application ID` for `Android` `SDK`s.&#x20;

The license is available with a `one-time payment`—meaning once you purchase it, you can use our `SDK` indefinitely without any recurring fees.

To request a license, please contact us:

> **Email:** <contact@kby-ai.com>&#x20;
>
> **Telegram:** @kbyai&#x20;
>
> **WhatsApp:** +19092802609&#x20;

## System Requirements

* **CPU:** 2 cores or more
* **RAM:** 150MB or more
* **OS:** Android 4.4 or later
* **Architecture:** arm64-v8a, armeabi-v7alibidsdk

## Setup

1. Copy the SDK (`libidsdk` folder) to the `root` folder of your project.
2. Add SDK to the project in `settings.gradle`

```gradle
include ':libidsdk'
```

3. Add dependency to your `build.gradle`

```gradle
implementation project(path: ':libidsdk')
```

## Initializing SDK

1. Step one

* To begin, you need to activate the SDK using the license that you have received.

```java
IDSDK.setActivation("...");
```

* If activation is successful, the return value will be `SDK_SUCCESS`. Otherwise, an error value will be returned.

2. Step Two

* After activation, call the SDK's initialization function.

```java
IDSDK.init(this);  //this -> MainActivity
```

* If initialization is successful, the return value will be `SDK_SUCCESS`. Otherwise, an error value will be returned.

## Enums and Classes

### 1. SDK\_ERROR

This enumeration represents the return value of the `init` and `setActivation` functions.

<table><thead><tr><th width="349.3333333333333">Feature</th><th width="99">Value</th><th>Name</th></tr></thead><tbody><tr><td>Successful activation or initialization</td><td>0</td><td>SDK_SUCCESS</td></tr><tr><td>License key error</td><td>-1</td><td>SDK_LICENSE_KEY_ERROR</td></tr><tr><td>AppID error (Not used in Server SDK)</td><td>-2</td><td>SDK_LICENSE_APPID_ERROR</td></tr><tr><td>License expiration</td><td>-3</td><td>SDK_LICENSE_EXPIRED</td></tr><tr><td>Not activated</td><td>-4</td><td>SDK_NO_ACTIVATED</td></tr><tr><td>Failed to initialize SDK</td><td>-5</td><td>SDK_INIT_ERROR</td></tr></tbody></table>

## APIs

### 1. setActivation

To begin, you need to activate the SDK using the license that you have received.

```kotlin
var ret = IDSDK.setActivation("...") 
```

If activation is successful, the return value will be `SDK_SUCCESS`. Otherwise, an error value will be returned.

### 2. init

After activation, call the SDK's initialization function.

```kotlin
ret = IDSDK.init(this)  //this -> MainActivity
```

If initialization is successful, the return value will be `SDK_SUCCESS`. Otherwise, an error value will be returned.

### 3. idcardRecognition

The SDK provides a `single API` for `ID card recognition`.&#x20;

The function can be used as follows:

```java
String result = IDSDK.idcardRecognition(bitmap);
```

This function takes a single parameter, which is a `bitmap` object.&#x20;

If the recognition is successful, the function will return a `JSON-formatted` string containing the recognized information. In case of failure, the return value will be `NULL`.
