Genius Scan SDK guide for Android

Overview

The Android SDK is provided as different Android libraries:

  • gs-sdk: the core module of the SDK including the low-level image processing, basic UI components and PDF generation
  • gs-sdk-ocr: the OCR module which allow to extract text (and layout) from images
  • gs-sdk-ui: a high-level scanner module that simplifies the integration of the SDK in your app.

Setup

Add the following code to your app’s build.gradle:

   repositories {
       ...
       maven { url 'https://s3.amazonaws.com/tgl.maven' }
   }

   dependencies {
      ...
      implementation 'com.thegrizzlylabs.geniusscan.sdk:gs-sdk:3.0.26'
   }

Manual

In Android Studio, create a new module and choose “Import from .AAR project” and choose the .aar file. Then create a new dependency for your app and choose the module that was created from the aar file. Clean and build the project.

License

The SDK can run without a license key but will stop working after 60 seconds.

To run it for longer than 60 seconds, you will need to initialize the SDK with your license key using the following command:

GeniusScanLibrary.init(context, "Your key")

This method throws an InitializationException when the license cannot be validated or has expired. It is advised to catch it and show a message to your users asking them to update the app.

Sample code

Two demo projects are provided in the SDK Demo apps repository:

  • demo-simple: it shows how to start a simple scan flow using gs-sdk-ui. The different screens are customizable via a ScanConfiguration.
  • demo-custom: this demo showcases how to build custom scan screens using the gs-sdk module. It also shows how to run OCR before generating a PDF file.

In order to run the provided demos, open the root folder in Android Studio.

Size of the SDK

The Android SDK includes support for the following CPU architectures: x86, x86_64, armeabi-v7a, arm64-v8a. When integrated into your app, the SDK will increase the size of your APK by the sizes in the following table:

Module x86 x86_64 armeabi-v7a arm64-v8a universal
gssdk-core 2.6MB 3.3MB 1.5MB 2.2MB 9.5MB
gssdk-ocr 1.4MB 1.5MB 984.8KB 1.3MB 5.1MB
gssdk-scanflow - - - - <1MB

If you’d like to optimize the size of your app, you can either:

© 2020 The Grizzly Labs, Inc. All rights reserved.