Development Guide

This page contains the information on Usage, Configuration, Result of OkayID Lite in Android, iOS and React-native

Usage

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

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
        }
    }
});

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
    }
})

The configurations by default are set as "true"

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

Path to the full document image captured

during the scanning process

Error Code

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.

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
        }
    }
});

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
    }
})

The configurations by default are set as "true"

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

Path to the full document image captured

during the scanning process

Error Code

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

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.

If it is not successful, the result will be returning nil

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

Path to the full document image captured

during the scanning process

Error Code

These are the error code that will be raised after each of the scanned is done.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.

If it is not successful, the result will be returning nil

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

Path to the full document image captured

during the scanning process

Error Code

These are the error code that will be raised after each of the scanned is done.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.

If it is not successful, the result will be returning nil

Result

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)

Last updated