This guide provides an overview of how to build and run the sample app using our Android SDK.

Prerequisites

These are the frameworks you must have before starting to use OCRLabs SDKs:

  • Android Studio or an equivalent IDE for Android development.
  • Minimum Android SDK version: 8.
  • The latest SDK files (version 3.6.1503.2022) and Code Sample App from your Account Manager

Step 1: Create a New Project

Create a new project or open a new one. To create a new project:

  • Open Android Studio > File > New > New Project.
  • On the New Project, click Phone, and Tablet.
  • Select Empty Activity from Phone and Tablet list.
  • Click Next.
  • On the Empty Activity, enter project Name, Language, and select Minimum SDK.
  • Click Finish.
600600

Step 2: Import SDK

To import the SDK:

  • Copy the SDK Package from the download folder to the folder libs in the app.
  • Click Android.
  • Select app > buid.gradle.
  • Under dependencies {, insert the following code.
implementation files('libs/orbitmrz-release.aar')
implementation files('libs/orbitsdk-release.aar')
implementation files('libs/orbitmedicare-release.aar')
  • Click sync now.
  • Save the file.
600600

Step 3: Initialize SDK

After importing SDK to your project, you must initialize the SDK using the steps below:

  • Open the app > src > main > java > com.
  • Right-click com > new > java class/file.
  • Give the file name MainActivity.
  • Under the package com.example.myapplication, insert the following code
import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

public class MainActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
}
  • Save the file.
600600

Step 4: Creating Buttons

To open SDK camera scanner:

  • On the app > res > layout > activity_main.xml.
  • Create three buttons for the three functions.
  • On the xml file > change the button text to Start SDK, Start Passport, Start Medicare.
600600

Step 5: Creating Functions through Buttons

To link the button for the function creation:

  • Insert the following code into the activity_main.xml under the button section.
android:onClick="OnStartSdkClick"
android:onClick="OnStartPassportClick"
android:onClick="OnStartMedicareClick"
  • This will create a function in the MainActivity.java.
  • Save the file.
600600

Step 6: Initialize the OrbitSDK

To initialize the orbitSdk:

  • Select app > src > main > java > MainActivity.java.
  • Import the following code below into the MainActivity.java
import com.ocrlabs.orbitsdk.OrbitSDK;
import com.ocrlabs.orbit.mrz.OrbitMrzSDK;
import com.ocrlabs.orbitmedicare.OrbitMedicareSDK;
  • After importing the code, you can choose to customize the SDK setting under the functions, below the example of the setting.
orbitSdk.uiSetting.scanBackSide = false;
orbitSdk.uiSetting.closeButton.buttonVisible = true;
orbitSdk.uiSetting.autoCaptureKode = false;
600600
  • Save the file.

Step 7: Enable Camera Scanner Function

To start enabling the camera scanner function:

  • Insert the following code under the public OrbitSDK(Activity activity) function:
orbitSdk.start(requestParam: "AUS_AUTO_DRIVERLICENCE", OrbitSDK.REQUEST_CODE_SCAN);
  • For the Passport, insert the following code under the public OrbitMrzSDK(Activity activity) function:
mrzSDK.start(OrbitMrzSDK.SCAN_REQUEST_CODE);
  • For the Medicare, insert the following code under the public OrbitMedicareSDK(Activity activity) function:
medicareSDK.start(OrbitMedicareSDK.REQUEST_CODE_SCAN);

Alt textAlt text

  • Save the File.

💬 We're here to help!

If you encounter an issue, a bug, or require assistance, please contact our support page here to find the solution. Don't forget to provide any important information on the issue.