Skip to main content

License Handling | Android Document Scanner

License checks in production apps#

Please note: From version 1.60.0 we have removed the app termination mechanism on license error and have added a special callback that helps to handle the Scanbot SDK license status.

val licenseInfo = ScanbotSDKInitializer()    .license(this, "")    .licenceErrorHandler(IScanbotSDKLicenseErrorHandler { status, feature, message ->        LoggerProvider.logger.d("ScanbotSDK", "license status:${}, message: $message")        when (status) {            StatusFailureNotSet,            StatusFailureCorrupted,            StatusFailureWrongOS,            StatusFailureAppIDMismatch,            StatusFailureExpired -> {                // licence is invalid completely            }            StatusOkay,            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 need                when (feature) {                    NoSdkFeature -> {}                    PayformDetection -> {}                    EdgeDetection -> {}                    // check for corresponding feature as needed                }            }        }    })    .initialize(this)

licenseInfo - new object that represents license information. It is also available from ScanbotSDK(context).licenseInfo

licenseInfo.status - enum for current license status:

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

  • StatusOkay - 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 Scanbot SDK with the new updated license string.

val licenseInfo = ScanbotSDKInitializer()    .license(this, "YOUR_UPDATED_LICENSE_STRING")    ...    .initialize(this)

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.