Skip to main content

SDK Initialization | Cordova Barcode Scanner

License Key

In order to run the Scanbot SDK within your production app, you must purchase and use a valid Scanbot SDK license.

Each license key is valid only for a given app bundle identifier. You will be unable to use any of the SDK features if the license key is corrupted, expired, or invalid in any other way.

Getting a Trial License

The Scanbot SDK will run without a license for one minute per session! To get a free, "no-strings-attached" 7-day trial license, please submit the Trial License Form on our website.

Please kindly note that a trial license can only be used in a development and staging environment. You are not allowed to publish your app to the App Store, Play Store, or any 3rd party Android App Store with a trial license.

Purchase a Production License

To get pricing information and purchase a production license for the Scanbot SDK please request a quote.

App Identifier

Every app has a unique identifier (sometimes also known as "bundle identifier" or "application ID"). Your license will be bound to this identifier. To request a trial license or purchase a production license you have to provide us the bundle identifier of your app.

To request a trial license or purchase a production license you have to provide us with the identifier of your app. Please find this identifier in the config.xml file of your Cordova app project:

<widget id="" ...>


Free Developer Support

We provide free "no-strings-attached" developer support for the implementation & testing of the Scanbot SDK. If you encounter technical issues with integrating the Scanbot SDK or need advice on choosing the appropriate framework or features, please visit our Support Page.

ScanbotBarcodeSdk.initializeSdk(successCallback, errorCallback, options) The Scanbot Barcode Scanner SDK must be initialized before usage. Make sure to call the initialization after the deviceready Cordova event has been fired.

The following arguments can be passed as options on initialization:


  • licenseKey: Your license key for the Scanbot Barcode Scanner SDK.
  • loggingEnabled: Optional logging flag. Recommended enabling for debug builds.
  • storageBaseDirectory: Optional directory as file URI to override the default storage directory. of the Scanbot Barcode Scanner SDK. The SDK stores the optional snapped images in this folder.
  • enableNativeLogging: Optional. Enables Scanbot SDK Core native logging (default is false, Android only).
  • useCameraX: Optional. If set to true, CameraX will be used for the RTU-UI components (default is true, Android only).
  • allowXnnpackAcceleration: Optional. Enables/disables XNNPACK acceleration for TensorFlow ML models, which provides highly optimized implementations of floating-point neural network operators (default is true, Android only).
  • allowGpuAcceleration: Optional. If set to false, GPU Acceleration will be disabled for Barcode Scanner, Document Scanner and Generic Document Recognizer (default is true, Android only).


import ScanbotBarcodeSDK from 'cordova-plugin-scanbot-barcode-scanner';

// Please note: this is just an example license key string (it is not a valid license)
var licenseKey =
"fXbN2PmyqEAZ+btdkSIS36TuX2j/EE5qxVNcZMXYErbLQ" +
"3OBnE10aOQxYI8L4UKwHiZ63jthvoFwUevttctBk0wVJ7Z" +
"+Psz3/Ry8w7pXvfpB1o+JrnzGGcfwBnRi/5raQ2THDeokR" +
"RB1keky2VBOFYbCfYt3Hqms5txF2z70PE/SBTMTIVuxL7q" +
"1xcHDHclbEBriDtrHw8Pmhh9FqTg/r/4kRN/oEX37QGp+Y" +
"3ogwIBbSmV+Cv+VuwtI31uXY3/GkyN/pSJZspIl+exwQDv" +
"O0O1/R/oAURpfM4ydaWReRJtjW8+b1r9rUgPERguaXfcse" +
"HlnclItgDfBHzUUFJJU/g==\nU2NhbmJvdFNESwppby5zY" +
"2FuYm90LmRlbW8ueGFtYXJpbgoxNDg0NjExMTk5CjcxNjc" +

var options = {
loggingEnabled: false,
storageBaseDirectory: 'file:///some/optional/custom/storage-folder/'

ScanbotBarcodeSdk.initializeSdk(function(result) {
// SDK initialized
}, function(error) {
// Error initializing the SDK
console.log('Unable to initialize the Scanbot Barcode Scanner SDK: ' + error);
}, options);

License Checks in Production Apps

If your Scanbot Barcode Scanner SDK license has expired, any call of the Scanbot Barcode Scanner SDK API will terminate your app or result in an error. To prevent this you should always check for license expiration during the runtime by calling the method ScanbotBarcodeSdk.getLicenseInfo(). If the result of await returns result.isLicenseValid == false, you should disable any usage of the Scanbot Barcode Scanner SDK functions or UI components in your app. We highly recommend implementing a suitable handling of this case in your app!

ScanbotBarcodeSdk.getLicenseInfo() Use this function to check the current state of the license. The SDK must be initialized.

ScanbotBarcodeSdk.getLicenseInfo(function(result) {
if (result.isLicenseValid) {
// Making your calls of the Scanbot Barcode Scanner SDK Plugin API is now safe.
// e.g. start the Barcode Scanner:
else {
// Implement a suitable handling (e.g. disable Scanbot functionality in your App)
alert("Scanbot SDK (trial) license has expired!");
}, sdkErrorCallback);


  • result.isLicenseValid : Contains a boolean status value of the license. true means the Scanbot Barcode Scanner SDK license is valid and all features can be used normally. false means the license is not valid and any call of the Scanbot Barcode Scanner SDK API will not work or result in an error.
  • result.licenseStatus : A LicenseStatus enum type that describes the status of the current license key.
  • result.licenseStatusMessage - A detailed message string for debugging purposes. Not intended for displaying in the UI for the end user.

License Status Types

  • LicenseStatus.StatusOkay : OK, the license key is valid.
  • LicenseStatus.StatusTrial : No license key installed, trial mode is active.
  • LicenseStatus.StatusFailureNotSet : License error: No license installed.
  • LicenseStatus.StatusFailureCorrupted : License error: The license key string is corrupted. Please check the format.
  • LicenseStatus.StatusFailureWrongOS : License error: The license key does not include support for current Operating System (Android or iOS).
  • LicenseStatus.StatusFailureAppIDMismatch : License error: The license key does not match the Application ID (on Android) or Bundle ID (on iOS) of the this app.
  • LicenseStatus.StatusFailureExpired : License error: License has expired.


When initializing the Scanbot Barcode Scanner SDK you can enable logging of the SDK. By default logging is disabled.

On Android logs are printed into LogCat as well as saved on the device. The easiest way to check the log outputs on Android is to use the Android Debug Bridge (adb). (e.g. $ adb -s <DEVICE_ID> shell "logcat")

On iOS all logs are printed to the console. Please use Xcode to check the log outputs. There will be no log files created by the Scanbot Barcode Scanner SDK plugin.

Please note: While it may be useful for development, consider switching logging OFF in production builds for security and performance reasons!

Want to scan longer than one minute?

Generate your free "no-strings-attached" Trial License and properly test the Scanbot SDK.

Get your free Trial License

What do you think of this documentation?