Initialization
This page covers the description of the initialization process
Demo license can be obtained here: https://licensing.regulaforensics.com.
The initialization of Document Reader is performed fully offline. The initializeReader method process license as an array of bytes, i.e. no matter when it's put to the project before the application is compiled or after. Here is an example of how to perform initialization with the license that is put to the resources folder of the project:
Java
Kotlin
1
//Reading the license from raw resource file
2
InputStream licInput = getResources().openRawResource(R.raw.regula);
3
int available = licInput.available();
4
byte[] license = new byte[available];
5
//noinspection ResultOfMethodCallIgnored
6
licInput.read(license);
7
8
DocumentReader.Instance().initializeReader(MainActivity.this, license, new IDocumentReaderInitCompletion() {
9
@Override
10
public void onInitCompleted(boolean success, Throwable error) {
11
if (success) {
12
//initialization successful
13
} else {
14
//Initialization was not successful
15
}
16
}
17
});
Copied!
1
//Reading the license from raw resource file
2
val licInput = resources.openRawResource(R.raw.regula)
3
val available = licInput.available()
4
val license = ByteArray(available)
5
6
licInput.read(license)
7
8
DocumentReader.Instance().initializeReader(
9
this@MainActivity, license
10
) { success, error_initializeReader ->
11
if (success) {
12
//initialization successful
13
} else {
14
//Initialization was not successful
15
}
16
}
Copied!
Last modified 11mo ago
Copy link