Skip to main content

License Handling | Flutter Document 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.

License checks in production apps

Future<void> _initScanbotSdk() async {
// Consider adjusting this optional storageBaseDirectory - see the comments below.
final customStorageBaseDirectory = await getDemoStorageBaseDirectory();

final encryptionParams = _getEncryptionParams();

var config = ScanbotSdkConfig(
// Consider switching logging OFF in production builds for security and performance reasons.
loggingEnabled: true,
licenseKey: SCANBOT_SDK_LICENSE_KEY,
imageFormat: ImageFormat.JPG,
imageQuality: 80,
licenseErrorHandler: (status, feature, message) {
Logger.root.info('License status: $status, $feature, $message');
switch (status) {
case Status.StatusOkay:
case Status.StatusTrial:
// license is valid but feature you trying to access is not available for this
// license key, handle this problem and reinit sdk with new license key if needed
switch (feature) {
case SdkFeature.EdgeDetection:
break;
case SdkFeature.PDFCreation:
break;
// check for corresponding feature as needed
}
break;
case Status.StatusFailureNotSet:
case Status.StatusFailureCorrupted:
case Status.StatusFailureWrongOS:
case Status.StatusFailureAppIDMismatch:
case Status.StatusFailureExpired:
// license is completely invalid
}
},
storageBaseDirectory: customStorageBaseDirectory,
documentDetectorMode: DocumentDetectorMode.ML_BASED,
encryptionParameters: encryptionParams);
try {
await ScanbotSdk.initScanbotSdk(config);
} catch (e) {
Logger.root.severe(e);
}
}

Get license status manually:

  var licenseInfo = await ScanbotSdk.getLicenseStatus();

licenseInfo - a new object that represents the license information.

licenseInfo.status - an enum for the current license status:

licenseInfo.licenseStatusMessage - a string that helps to understand the current license status

  • StatusOkay - The license is valid and accepted.
  • StatusTrial - No license set yet. The SDK is in trial mode.
  • StatusFailureNotSet - No license set yet. The SDK's trial mode is over.
  • StatusFailureCorrupted - No license active. The set license was unreadable or has an invalid format.
  • StatusFailureWrongOS - No license active. The set license does not cover the current operating system.
  • StatusFailureAppIDMismatch - No license active. The set license does not cover the current app's bundle identifier.
  • StatusFailureExpired - No license active. The set license is valid but it has expired.

licenseInfo.expirationDate - returns Date of license key expiration or null if license is not valid

Updating the license in production apps

Please also note: To renew an expired license or extend a valid license with new Scanbot SDK features, you will have to reinitialize the Scanbot SDK with the new updated license string.

   var config = ScanbotSdkConfig(
licenseKey: SCANBOT_SDK_LICENSE_KEY,)
try {
await ScanbotSdk.initScanbotSdk(config);
} catch (e) {
Logger.root.severe(e);
}

The expiration date and the feature list of a license are contained in an encrypted data part of the license key string. This means a renewal or extension of a license will cause a new license key string to be generated.

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?