Skip to main content

SDK Initialization

License Key

The Docutain Barcode Scanner SDK needs a valid, non-expired license key in order to work. The license key is bound to the applicationId defined in your app's build.gradle file. Any attempt to use a license key in an app with a different applicationId will fail.

Trial license

In order to get a trial license, please contact us.

Production license

To get information about the SDK's functionality and pricing and to purchase a production license, please contact us.

Initialize

In order to use any functionality of the SDK, you must initialize it first. Add the following code to your Application class:

import de.docutain.sdk.DocutainSDK;

class CustomApplication : Application() {

override fun onCreate() {
super.onCreate()
if(!DocutainSDK.initSDK(this, YOUR_LICENSE_KEY)){
//init of Docutain SDK failed, get the last error message
val error = DocutainSDK.getLastError()
//your logic to deactivate access to SDK functionality
//...
}
}
}
caution

If the initialization fails, you are responsible to deactivate access to SDK functionality.

tip

If you don't use a custom Application class yet, create a new class, copy the code from above and register the new application class in the AndroidManifest.xml

<application
android:name="com.example.app.CustomApplication"
... >
</application>