> For the complete documentation index, see [llms.txt](https://api2-ekycapis.innov8tif.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://api2-ekycapis.innov8tif.com/okayid-mobile-sdk/okayid-lite-mobile-sdk-all/development-guide.md).

# Development Guide

{% tabs %}
{% tab title="Android" %}

### Usage

For Android, a valid license key is required to start the process.

{% code title="Java" %}

```java
Config config = new Config.Builder()
    

OkayLiteActivity.startMyKadScanning(this, LICENSE_KEY, config, new OkayLiteResultListener() {
    @Override
    public void onResultReceived(boolean isSuccess, int errorCode, MyKadResult result) {
        Logger.d("result => " + result);
        if (isSuccess) {
            //do something with success result
        } else {
            //do something with error
        }
    }
});


```

{% endcode %}

{% code title="Kotlin" %}

```kotlin
//By default it is true
val config = Config.Builder()
    .setExtractAddress(false)
    .setExtractReligion(false)
    .setExtractGender(false)
    .build()
        
OkayLiteActivity.startMyKadScanning(this, LICENSE_KEY,config,
{ isSuccess, errorCode, result ->
    if (isSuccess) {
        //do something with success result
    } else {
        //do something with error
    }
})
```

{% endcode %}

{% hint style="info" %}
The configurations by default are set as "true"
{% endhint %}

### Result

These are the explanation of the results that the OkayID Lite will be returning as follow:

| Property         | Description                                                                        |
| ---------------- | ---------------------------------------------------------------------------------- |
| fullName         | Full name                                                                          |
| icNumber         | IC number                                                                          |
| gender           | Gender                                                                             |
| dob              | Date of Birth                                                                      |
| religion         | Religion                                                                           |
| address          | Full address                                                                       |
| fullDocumentPath | <p>Path to the full document image captured </p><p>during the scanning process</p> |

### Error Code&#x20;

These are the error code that will be raised after each of the scanned is done.

| Error Code | Constant Name                            | Description                                                                            |
| ---------- | ---------------------------------------- | -------------------------------------------------------------------------------------- |
| -1         | MyKadResult.NO\_ERROR                    | MyKad has been successfully scanned                                                    |
| 1          | MyKadResult.ERROR\_INVALID\_LICENSE\_KEY | The license is invalid                                                                 |
| 2          | MyKadResult.ERROR\_PERMISESSION\_DENIED  | The user does not grant permission to access the camera and storage in order to do OCR |
| 3          | MyKadResult.ERROR\_USER\_CANCEL\_ACTION  | The user cancels during the scanning process (eg. user press back button)              |

For Android, a valid license key is required to start the process.

{% code title="Java" %}

```java
Config config = new Config.Builder()
    

OkayLiteActivity.startMyKadScanning(this, LICENSE_KEY, config, new OkayLiteResultListener() {
    @Override
    public void onResultReceived(boolean isSuccess, int errorCode, MyKadResult result) {
        Logger.d("result => " + result);
        if (isSuccess) {
            //do something with success result
        } else {
            //do something with error
        }
    }
});


```

{% endcode %}

{% code title="Kotlin" %}

```kotlin
//By default it is true
val config = Config.Builder()
    .setExtractAddress(false)
    .setExtractReligion(false)
    .setExtractGender(false)
    .build()
        
OkayLiteActivity.startMyKadScanning(this, LICENSE_KEY,config,
{ isSuccess, errorCode, result ->
    if (isSuccess) {
        //do something with success result
    } else {
        //do something with error
    }
})
```

{% endcode %}

{% hint style="info" %}
The configurations by default are set as "true"
{% endhint %}

### Result

These are the explanation of the results that the OkayID Lite will be returning as follow:

| Property         | Description                                                                        |
| ---------------- | ---------------------------------------------------------------------------------- |
| fullName         | Full name                                                                          |
| icNumber         | IC number                                                                          |
| gender           | Gender                                                                             |
| dob              | Date of Birth                                                                      |
| religion         | Religion                                                                           |
| address          | Full address                                                                       |
| fullDocumentPath | <p>Path to the full document image captured </p><p>during the scanning process</p> |

### Error Code&#x20;

These are the error code that will be raised after each of the scanned is done.

<table><thead><tr><th width="150">Error Code</th><th width="150">Constant Name</th><th>Description</th></tr></thead><tbody><tr><td>-1</td><td>MyKadResult.NO_ERROR</td><td>MyKad has been successfully scanned</td></tr><tr><td>1</td><td>MyKadResult.ERROR_INVALID_LICENSE_KEY</td><td>The license is invalid</td></tr><tr><td>2</td><td>MyKadResult.ERROR_PERMISESSION_DENIED</td><td>The user does not grant permission to access the camera and storage in order to do OCR</td></tr><tr><td>3</td><td>MyKadResult.ERROR_USER_CANCEL_ACTION</td><td><p>Usage</p><p>For iOS, there are a few steps that needed to be followed as below:</p><ul><li>Then, import "<strong>OkayIDLite"</strong> module into the swift file.</li></ul><pre><code>import OkayIDLite
</code></pre><ul><li>After that, build the configuration object as follow:</li></ul><pre><code>let config = Config.Builder()
    .setExtractAddress(true) // Toggle address extraction
    .setExtractGender(true) // Toggle gender extraction
    .setExtractReligion(true) // Toggle religion extraction
    .build()
</code></pre><ul><li>Then, start the process by calling "startMyKadScanning" on the <strong>OkayIDLite</strong> class with the config object. It is also a must to pass a valid license string and a reference to the view controller. The "self" is referring to the current view controller in the example below:</li></ul><pre><code>OkayIDLiteSDK.startMyKadScanning(
    viewController: self,
    license: lic,
    config: config
)
{ success, errorCode, result in
    if(success) {
        // handle success
    } else {
        // handle error
    }
}
</code></pre><p>Code above is an example to handle the success or failure of the MyKad scanning that the action can be customized by the user.</p><p>If it is not successful, the result will be returning nil</p><h3>Result</h3><p>These are the explanation of the results that the OkayID Lite will be returning as follow:</p><h3>Error Code </h3><p>These are the error code that will be raised after each of the scanned is done.Usage</p><p>For iOS, there are a few steps that needed to be followed as below:</p><ul><li>Then, import "<strong>OkayIDLite"</strong> module into the swift file.</li></ul><pre><code>import OkayIDLite
</code></pre><ul><li>After that, build the configuration object as follow:</li></ul><pre><code>let config = Config.Builder()
    .setExtractAddress(true) // Toggle address extraction
    .setExtractGender(true) // Toggle gender extraction
    .setExtractReligion(true) // Toggle religion extraction
    .build()
</code></pre><ul><li>Then, start the process by calling "startMyKadScanning" on the <strong>OkayIDLite</strong> class with the config object. It is also a must to pass a valid license string and a reference to the view controller. The "self" is referring to the current view controller in the example below:</li></ul><pre><code>OkayIDLiteSDK.startMyKadScanning(
    viewController: self,
    license: lic,
    config: config
)
{ success, errorCode, result in
    if(success) {
        // handle success
    } else {
        // handle error
    }
}
</code></pre><p>Code above is an example to handle the success or failure of the MyKad scanning that the action can be customized by the user.</p><p>If it is not successful, the result will be returning nil</p><h3>Result</h3><p>These are the explanation of the results that the OkayID Lite will be returning as follow:</p><h3>Error Code </h3><p>These are the error code that will be raised after each of the scanned is done.Usage</p><p>For iOS, there are a few steps that needed to be followed as below:</p><ul><li>Then, import "<strong>OkayIDLite"</strong> module into the swift file.</li></ul><pre><code>import OkayIDLite
</code></pre><ul><li>After that, build the configuration object as follow:</li></ul><pre><code>let config = Config.Builder()
    .setExtractAddress(true) // Toggle address extraction
    .setExtractGender(true) // Toggle gender extraction
    .setExtractReligion(true) // Toggle religion extraction
    .build()
</code></pre><ul><li>Then, start the process by calling "startMyKadScanning" on the <strong>OkayIDLite</strong> class with the config object. It is also a must to pass a valid license string and a reference to the view controller. The "self" is referring to the current view controller in the example below:</li></ul><pre><code>OkayIDLiteSDK.startMyKadScanning(
    viewController: self,
    license: lic,
    config: config
)
{ success, errorCode, result in
    if(success) {
        // handle success
    } else {
        // handle error
    }
}
</code></pre><p>Code above is an example to handle the success or failure of the MyKad scanning that the action can be customized by the user.</p><p>If it is not successful, the result will be returning nil</p><h3>Result</h3><p>These are the explanation of the results that the OkayID Lite will be returning as follow:UsageThe user cancels during the scanning process (eg. user press back button)</p></td></tr></tbody></table>

| Property         | Description                                                                        |
| ---------------- | ---------------------------------------------------------------------------------- |
| fullName         | Full name                                                                          |
| icNumber         | IC number                                                                          |
| gender           | Gender                                                                             |
| dob              | Date of Birth                                                                      |
| religion         | Religion                                                                           |
| address          | Full address                                                                       |
| fullDocumentPath | <p>Path to the full document image captured </p><p>during the scanning process</p> |

| Property         | Description                                                                        |
| ---------------- | ---------------------------------------------------------------------------------- |
| fullName         | Full name                                                                          |
| icNumber         | IC number                                                                          |
| gender           | Gender                                                                             |
| dob              | Date of Birth                                                                      |
| religion         | Religion                                                                           |
| address          | Full address                                                                       |
| fullDocumentPath | <p>Path to the full document image captured </p><p>during the scanning process</p> |
| {% endtab %}     |                                                                                    |

{% tab title="iOS" %}

### Usage

For iOS, there are a few steps that needed to be followed as below:

* Then, import "**OkayIDLite"** module into the swift file.

```
import OkayIDLite
```

* After that, build the configuration object as follow:

```
let config = Config.Builder()
    .setExtractAddress(true) // Toggle address extraction
    .setExtractGender(true) // Toggle gender extraction
    .setExtractReligion(true) // Toggle religion extraction
    .build()
```

* Then, start the process by calling "startMyKadScanning" on the **OkayIDLite** class with the config object. It is also a must to pass a valid license string and a reference to the view controller. The "self" is referring to the current view controller in the example below:

```
OkayIDLiteSDK.startMyKadScanning(
    viewController: self,
    license: lic,
    config: config
)
{ success, errorCode, result in
    if(success) {
        // handle success
    } else {
        // handle error
    }
}
```

Code above is an example to handle the success or failure of the MyKad scanning that the action can be customized by the user.

{% hint style="info" %}
If it is not successful, the result will be returning nil
{% endhint %}

### Result

These are the explanation of the results that the OkayID Lite will be returning as follow:

| Property         | Description                                                                        |
| ---------------- | ---------------------------------------------------------------------------------- |
| fullName         | Full name                                                                          |
| icNumber         | IC number                                                                          |
| gender           | Gender                                                                             |
| dob              | Date of Birth                                                                      |
| religion         | Religion                                                                           |
| address          | Full address                                                                       |
| fullDocumentPath | <p>Path to the full document image captured </p><p>during the scanning process</p> |

### Error Code&#x20;

These are the error code that will be raised after each of the scanned is done.

| Error Code   | Constant Name                                  | Description                                                                                               |
| ------------ | ---------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
| -1           | MyKadResult.NO\_ERROR                          | MyKad has been successfully scanned                                                                       |
| 1            | MyKadResult.ERROR\_INVALID\_LICENSE\_KEY       | The license is invalid                                                                                    |
| 2            | MyKadResult.ERROR\_PERMISSION\_DENIED          | The user did not grant permission to access the camera in order to do OCR                                 |
| 3            | MyKadResult.ERROR\_USER\_CANCEL\_ACTION        | The user cancelled during the scanning process                                                            |
| 4            | MyKadResult.ERROR\_UNSUPPORTED\_CAMERA\_PRESET | The device's camera does not support the required preset for video OCRMyKad has been successfully scanned |
| {% endtab %} |                                                |                                                                                                           |

{% tab title="React-native" %}

### Usage

For React-native, this is an example for the document capture for the custom camera UI design as following:&#x20;

```
import RNOkayidLite from "react-native-okayid-lite"

//By default it is true
RNOkayidLite.startMykadScanning({
    license: license,
    extractAddress: false,
    extractGender: false,
    extractReligion: false
})
    .then(result => {
        console.log(result)
    })
    .catch(error => {
        console.log(error)
    })

```

### Configuration

There are some configurations object to be followed in the development stage. The configurations that are going to show below can be implemented into the **Usage** section above.

### Result

<table><thead><tr><th width="318.5">Property</th><th>Description</th></tr></thead><tbody><tr><td>fullName</td><td>Full name</td></tr><tr><td>icNumber</td><td>IC number</td></tr><tr><td>gender</td><td>Gender</td></tr><tr><td>dob</td><td>Date of birth</td></tr><tr><td>religion</td><td>Religion</td></tr><tr><td>address</td><td>Full address</td></tr><tr><td>fullDocumentImage</td><td>Path to the full document image captured during the scanning process</td></tr></tbody></table>

### Error Code

| Error                                    | Description                                                               |
| ---------------------------------------- | ------------------------------------------------------------------------- |
| invalid license                          | The license is invalid                                                    |
| permission denied                        | The user did not grant permission to access the camera in order to do OCR |
| cancel                                   | The user cancelled during the scanning process                            |
| failed                                   | Unexpected error                                                          |
| unsupported camera preset **(iOS Only)** | The device's camera does not support the required preset for video OCR.   |

tetet
{% endtab %}
{% endtabs %}
