-
Notifications
You must be signed in to change notification settings - Fork 48
Expand file tree
/
Copy pathExampleApplication.kt
More file actions
executable file
·55 lines (46 loc) · 2.34 KB
/
ExampleApplication.kt
File metadata and controls
executable file
·55 lines (46 loc) · 2.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package io.scanbot.example
import android.app.Application
import io.scanbot.sdk.ScanbotSDK
import io.scanbot.sdk.ScanbotSDKInitializer
import io.scanbot.sdk.util.log.LoggerProvider
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.launch
import kotlin.coroutines.CoroutineContext
class ExampleApplication : Application(), CoroutineScope {
private var job: Job = Job()
override val coroutineContext: CoroutineContext
get() = Dispatchers.IO + job
/*
* TODO 1/2: Add the Scanbot SDK license key here.
* Please note: The Scanbot SDK will run without a license key for one minute per session!
* After the trial period is over all Scanbot SDK functions as well as the UI components will stop working.
* You can get an unrestricted "no-strings-attached" 30 day trial license key for free.
* Please submit the trial license form (https://scanbot.io/trial/) on our website by using
* the app identifier "io.scanbot.example.sdk.android" of this example app.
*/
val licenseKey = ""
override fun onCreate() {
super.onCreate()
ScanbotSDKInitializer()
.withLogging(true)
// TODO 2/2: Enable the Scanbot SDK license key
//.license(this, licenseKey)
.licenseErrorHandler { status, feature, statusMessage ->
LoggerProvider.logger.d("ExampleApplication", "+++> License status: ${status.name}. Status message: $statusMessage")
LoggerProvider.logger.d("ExampleApplication", "+++> Feature not available: ${feature.name}")
}
//.sdkFilesDirectory(this, getExternalFilesDir(null)!!)
.initialize(this)
LoggerProvider.logger.d("ExampleApplication", "Scanbot SDK was initialized")
val licenseInfo = ScanbotSDK(this).licenseInfo
LoggerProvider.logger.d("ExampleApplication", "License status: ${licenseInfo.status}")
LoggerProvider.logger.d("ExampleApplication", "License isValid: ${licenseInfo.isValid}")
LoggerProvider.logger.d("ExampleApplication", "License expirationDate: ${licenseInfo.expirationDateString}")
launch {
// Clear all previously created documents in storage
ScanbotSDK(this@ExampleApplication).documentApi.deleteAllDocuments()
}
}
}