Skip to main content

SDK Initialization

License Key​

The Docutain SDK is a commercial product and requires a paid license for production use.

It needs a valid, non-expired license key in order to work. The license is bound to the application identifiers of your Android and iOS apps.

Trial license​

Without a license key, you can test the Docutain SDK for 60 seconds. After that, you need to restart the app to continue testing.

To get a free trial license, visit https://sdk.docutain.com/TrialLicense.

Production license​

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

Initialize the SDK​

Make sure you have followed the Getting started guide.

In order to use any functionality of the SDK, you must initialize it first. Call initSdk during your application startup:

import de.docutain.sdk.kmp.DocutainException
import de.docutain.sdk.kmp.DocutainSdk

try {
DocutainSdk.initSdk("<YOUR-LICENSE-KEY>")
} catch (exception: DocutainException) {
// initialization of the Docutain SDK failed
// your logic to deactivate access to SDK functionality
}
caution

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

initSdk returns Unit and throws DocutainException if initialization fails. See Error Handling for more details.

Logging​

The SDK writes certain information into a log file. You can get its file:// URL by calling DocutainSdk.getTraceFile(). You can send this log file to us if you have any issues/bugs with the SDK. The Logger has certain levels that you can set depending on your needs. However, we suggest to leave the level to it's default value which ensures that in case of any issues/bugs we can get all the information we need from you.

import de.docutain.sdk.kmp.LogLevel

// get the log file
val logFile = DocutainSdk.getTraceFile()

// set the log level
DocutainSdk.setLogLevel(LogLevel.VERBOSE)

Depending on the log level, some temporary files get written. These files, if any, will be deleted everytime the SDK starts, so you don't need to worry about spamming the files dir.

If you like, you can delete these files manually by using DocutainSdk.deleteTempFiles. Pass true if the content of the trace file should be deleted as well.

// delete the temporary files, but keep the trace file content
DocutainSdk.deleteTempFiles(deleteTraceFileContent = false)