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
Java
//Reading the license from raw resource file
InputStream licInput = getResources().openRawResource(R.raw.regula);
int available = licInput.available();
byte[] license = new byte[available];
//noinspection ResultOfMethodCallIgnored
licInput.read(license);
DocumentReader.Instance().initializeReader(MainActivity.this, license, new IDocumentReaderInitCompletion() {
@Override
public void onInitCompleted(boolean success, Throwable error) {
if (success) {
//initialization successful
} else {
//Initialization was not successful
}
}
});
Kotlin
//Reading the license from raw resource file
val licInput = resources.openRawResource(R.raw.regula)
val available = licInput.available()
val license = ByteArray(available)
licInput.read(license)
DocumentReader.Instance().initializeReader(
this@MainActivity, license
) { success, error_initializeReader ->
if (success) {
//initialization successful
} else {
//Initialization was not successful
}
}