Skip to main content

Building Production Apps | Cordova Document Scanner

Android

The Scanbot Android SDK uses native libraries under the hood and supports the following ABIs: armeabi-v7a, arm64-v8a, x86 and x86_64.

By default the native libraries of all these architectures will be included in the app package (APK), which will result in a big APK file. Please consider removing support for x86 and x86_64 architectures. In most cases both "x86" architectures can be removed for the release (production) build, since they are only used on emulators and on some rare devices with the Intel Atom architecture.

To exclude certain ABIs from the APK, use the abiFilters property in the Android Gradle settings of your project. To apply any custom Gradle settings on a Cordova generated Android project, create the additional custom .gradle file with the name

platforms/android/app/build-extras.gradle

and define your custom Gradle settings in it. In this case we define abiFilters to exclude x86 and x86_64 architectures:

ext.postBuildExtras = {
android.defaultConfig.ndk.abiFilters = ["armeabi-v7a", "arm64-v8a"]
}

💡 However, if you need to support all architectures and to optimize the APK size, we highly recommend checking out the Android App Bundle approach. It allows you to create and distribute dedicated and smaller APKs via the PlayStore (basically it is similar to the iOS App Store approach).

License Check

If your Scanbot SDK license has expired, any call of the Scanbot SDK API will result in an error. To prevent this you should always check for license expiration during the runtime by calling and checking the result of the API method getLicenseInfo(). If the result result.info.isLicenseValid is false, you should disable any usage of the Scanbot SDK functions or UI components in your app.

info

We highly recommend implementing a suitable handling of this case in your app!

const result = await this.SDK.getLicenseInfo();
if (result.info.isLicenseValid) {
// OK, we have a valid license. Making the calls of the Scanbot SDK plugin API is now safe.
// E.g. launch the Document Scanner UI
// this.SDK.UI.startDocumentScanner(...)
} else {
// Implement a suitable handling (e.g. disable Scanbot functionality in your app)
alert('Scanbot SDK license is not valid!');
}

Result fields:

  • result.info.isLicenseValid: boolean - Whether the license is valid or not.
  • result.info.licenseStatus: LicenseStatus - Status of the license as LicenseStatus enum. See enum values and description below.
  • result.info.licenseExpirationDate?: number - Optional expiration date of the license.

LicenseStatus enum values:

  • LicenseStatus.Okay - License is valid.
  • LicenseStatus.Trial - No license installed, trial mode is active.
  • LicenseStatus.Expired - License error: License has expired.
  • LicenseStatus.WrongOS - License error: License does not include support for current operating system.
  • LicenseStatus.Corrupted - License error: License key string is invalid or corrupted. Please check the format of the string.
  • LicenseStatus.AppIDMismatch - License error: License does not include the Bundle ID or Application ID of this app.
  • LicenseStatus.NotSet - License error: No license installed (e.g. when trial mode is over).
  • LicenseStatus.Unknown - Unknown license status. Please contact support.

Want to scan longer than one minute?

Generate a free trial license to test the Scanbot SDK thoroughly.

Get your free Trial License

What do you think of this documentation?


On this page

Scroll to top