Migration Guide

This page contains guidance for migrating from one version to another

Migrating from v5.4 to v5.5

Implementations

Changed names of Core packages. Take a look at the following page:

Migrating from v5.3 to v5.4

Errors are returned as DocumentReaderException instead of Throwable.

Migrating from v5.2 to v5.3

Custom settings

Use setCameraSize(int width, int height) instead of setCameraSize(Camera.Size cameraSize).

Results

Migrating from v5.1 to v5.2

Errors are returned as Throwable now.

The database has to be updated along with the SDK as it's a part of it.

Migrating from v5.0 to v5.1

If you build an app with AndroidX, you have to enable the Jetifier plugin that automatically migrates existing third-party libraries to use AndroidX. See how.

Database

The database has to be updated along with the SDK as it's a part of it.

Show scanner

If the below error was encountered, make sure that the right context had been passed to the showScanner() method, i.e. it has to be the context of the activity rather than the application.

Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?

Custom settings

Custom settings of the Customization and Functionality class have to be set in the following way:

Java
Kotlin
Java
DocumentReader.Instance().customization().edit().setStatus("Hello").applyImmediately(MainActivity.this);
DocumentReader.Instance().customization().edit().setShowHelpAnimation(true).apply();
DocumentReader.Instance().functionality().edit().setShowCaptureButton(true).apply();
DocumentReader.Instance().functionality().edit().setVideoCaptureMotionControl(true).apply();
Kotlin
DocumentReader.Instance().customization().edit().setStatus("Hello").applyImmediately(this@MainActivity)
DocumentReader.Instance().customization().edit().setShowHelpAnimation(true).apply()
DocumentReader.Instance().functionality().edit().setShowCaptureButton(true).apply()
DocumentReader.Instance().functionality().edit().setVideoCaptureMotionControl(true).apply()

Completion

DocumentReader.DocumentReaderCompletion was changed to IDocumentReaderCompletion.

DocumentReader.DocumentReaderInitCompletion was changed to IDocumentReaderInitCompletion.

DocumentReader.DocumentReaderPrepareCompletion was changed to IDocumentReaderPrepareCompletion.

Migrating from v4.2 to v5.0

Dependencies

Make sure that the new common library is added to the project and presented in the External Libraries list, otherwise, you may encounter the following errors:

/.../.gradle/caches/transforms-2/files-2.1/e8e5c59b760de91277d4b26b128becb5/res/layout/help_bt_device_fragment.xml:8: AAPT: error: resource dimen/reg_img_button_size (aka com.regula.documentreader:dimen/reg_img_button_size) not found.
/.../.gradle/caches/transforms-2/files-2.1/e8e5c59b760de91277d4b26b128becb5/res/layout/help_bt_device_fragment.xml:8: AAPT: error: resource dimen/reg_small_img_button_padding (aka com.regula.documentreader:dimen/reg_small_img_button_padding) not found.
/.../.gradle/caches/transforms-2/files-2.1/e8e5c59b760de91277d4b26b128becb5/res/layout/help_bt_device_fragment.xml:8: AAPT: error: resource drawable/reg_close (aka com.regula.documentreader:drawable/reg_close) not found.
/.../.gradle/caches/transforms-2/files-2.1/e8e5c59b760de91277d4b26b128becb5/res/layout/help_bt_device_fragment.xml:33: AAPT: error: resource style/PrimaryButton (aka com.regula.documentreader:style/PrimaryButton) not found.
/.../.gradle/caches/transforms-2/files-2.1/e8e5c59b760de91277d4b26b128becb5/res/layout/help_bt_device_fragment.xml:40: AAPT: error: resource style/PrimaryButton (aka com.regula.documentreader:style/PrimaryButton) not found.
/.../.gradle/caches/transforms-2/files-2.1/e8e5c59b760de91277d4b26b128becb5/res/layout/help_bt_device_fragment.xml:47: AAPT: error: resource style/PrimaryButton (aka com.regula.documentreader:style/PrimaryButton) not found.
/.../.gradle/caches/transforms-2/files-2.1/e8e5c59b760de91277d4b26b128becb5/res/layout/reg_activity_capture.xml:118: AAPT: error: resource dimen/reg_img_button_size (aka com.regula.documentreader:dimen/reg_img_button_size) not found.
/.../.gradle/caches/transforms-2/files-2.1/e8e5c59b760de91277d4b26b128becb5/res/layout/reg_activity_capture.xml:118: AAPT: error: resource dimen/reg_small_img_button_padding (aka com.regula.documentreader:dimen/reg_small_img_button_padding) not found.
/.../.gradle/caches/transforms-2/files-2.1/e8e5c59b760de91277d4b26b128becb5/res/layout/reg_activity_capture.xml:118: AAPT: error: resource drawable/reg_flash_off (aka com.regula.documentreader:drawable/reg_flash_off) not found.
/.../.gradle/caches/transforms-2/files-2.1/e8e5c59b760de91277d4b26b128becb5/res/layout/reg_activity_capture.xml:132: AAPT: error: resource dimen/reg_img_button_size (aka com.regula.documentreader:dimen/reg_img_button_size) not found.
/.../.gradle/caches/transforms-2/files-2.1/e8e5c59b760de91277d4b26b128becb5/res/layout/reg_activity_capture.xml:132: AAPT: error: resource dimen/reg_small_img_button_padding (aka com.regula.documentreader:dimen/reg_small_img_button_padding) not found.
/.../.gradle/caches/transforms-2/files-2.1/e8e5c59b760de91277d4b26b128becb5/res/layout/reg_activity_capture.xml:132: AAPT: error: resource drawable/reg_camera_swap (aka com.regula.documentreader:drawable/reg_camera_swap) not found.
/.../.gradle/caches/transforms-2/files-2.1/e8e5c59b760de91277d4b26b128becb5/res/layout/reg_activity_capture.xml:143: AAPT: error: resource dimen/reg_img_button_size (aka com.regula.documentreader:dimen/reg_img_button_size) not found.
/.../.gradle/caches/transforms-2/files-2.1/e8e5c59b760de91277d4b26b128becb5/res/layout/reg_activity_capture.xml:143: AAPT: error: resource drawable/reg_capture_activity_camera (aka com.regula.documentreader:drawable/reg_capture_activity_camera) not found.
/.../.gradle/caches/transforms-2/files-2.1/e8e5c59b760de91277d4b26b128becb5/res/layout/reg_activity_capture.xml:164: AAPT: error: resource dimen/reg_img_button_size (aka com.regula.documentreader:dimen/reg_img_button_size) not found.

Custom settings

Custom settings should be declared in the following way:

Java
Kotlin
Java
DocumentReader.Instance().processParams().scenario = "Mrz";
DocumentReader.Instance().customization().setShowResultStatusMessages(true);
DocumentReader.Instance().rfidScenario().setMrz(accessKey);
Kotlin
DocumentReader.Instance().processParams().scenario = "Mrz"
DocumentReader.Instance().customization().isShowResultStatusMessages = true
DocumentReader.Instance().rfidScenario().setMrz(accessKey)

Document Type Result

documentType is an array now that contains information about each page that has been read.

Text Result

Total text result status takes one of eCheckResult enum values instead of eRPRM_FieldVerificationResult.

Graphic Result

GT_DOCUMENT_REAR was removed and GT_DOCUMENT_FRONT was renamed to GF_DOCUMENT_IMAGE (see eGraphicFieldType enum). In order to get the appropriate document side you should use the new property pageIndex, which is available in DocumentReaderGraphicResult class, e.g. pageIndex = 0 - it’s the first (front) side of the document, pageIndex = 1 - it’s the second (back) side of the document:

Java
Kotlin
Java
// Get document side image (first page)
Bitmap documentImageFirstPage = results.getGraphicFieldImageByType(eGraphicFieldType.GF_DOCUMENT_IMAGE, -1, 0);
// Get document side image (second page)
Bitmap documentImageSecondPage = results.getGraphicFieldImageByType(eGraphicFieldType.GF_DOCUMENT_IMAGE, -1, 1);
Kotlin
// Get document side image (first page)
val documentImageFirstPage = results.getGraphicFieldImageByType(eGraphicFieldType.GF_PORTRAIT, -1, 0)
// Get document side image (second page)
val documentImageSecondPage = results.getGraphicFieldImageByType(eGraphicFieldType.GF_DOCUMENT_IMAGE, -1, 0)