Skip to content

Migration Guide: From 4.x To 5.x

From v5.7 To v5.8

  • All fields in the ProcessParams class changed from primitive type to object types, for example:
DocumentReader.Instance().processParams().multipageProcessing = null;
DocumentReader.Instance().processParams().multipageProcessing = null
  • Changed the type for the forceDocID field in ProcessParams from Boolean to Integer.

From v5.4 To v5.5

Implementations

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

From v5.3 To v5.4

Errors are returned as DocumentReaderException instead of Throwable.

From v5.2 To v5.3

Custom settings

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

Results

  • Removed overallResult from DocumentReaderResults. Use getOverallResult instead.
  • Removed jsonResult from DocumentReaderResults. Use rawResult instead.

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.

From v5.0 To v5.1

Info

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 Configuration and Functionality class have to be set in the following way:

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();
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.

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:

DocumentReader.Instance().processParams().scenario = "Mrz";

DocumentReader.Instance().customization().setShowResultStatusMessages(true);

DocumentReader.Instance().rfidScenario().setMrz(accessKey);
DocumentReader.Instance().processParams().scenario = "Mrz"

DocumentReader.Instance().customization().isShowResultStatusMessages = true

DocumentReader.Instance().rfidScenario().setMrz(accessKey)

Document Type Result

documentType is an array that now 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:

// 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);
// 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)