DOT Android Document 5.0.0

This guide describes how to migrate DOT Android Document version 3.x to version 5.0. Only the most important changes are highlighted in this guide. For more details, see the Android Samples.

Migration Steps (Kotlin)

New SDK versioning

  • Replace individual versions of all libraries (DOT Document, DOT Face, DOT Face Lite and DOT NFC) with a single version name. Libraries with the same version name work correctly at build time and at run time.

Before

dotDocumentVersion = '3.7.1'
dotFaceVersion = '4.11.0'
dotNfcVersion = '2.3.4'
//…
implementation "com.innovatrics.dot:dot-document:$dotDocumentVersion"
implementation "com.innovatrics.dot:dot-face-detection-fast:$dotFaceVersion"
implementation "com.innovatrics.dot:dot-nfc:$dotNfcVersion"

After

dotVersion = '5.0.0'
//…
implementation "com.innovatrics.dot:dot-document:$dotVersion"
implementation "com.innovatrics.dot:dot-face-detection-fast:$dotVersion"
implementation "com.innovatrics.dot:dot-nfc:$dotVersion"

DocumentAutoCaptureConfiguration.Builder

  • In order to start configuration of quality attribute thresholds call startQualityAttributeThresholds() to get instance of QualityAttributeThresholds.Builder and QualityAttributeThresholds.Builder.end() after all thresholds are configured.
  • Replace confidenceLowThreshold() with QualityAttributeThresholds.Builder.minConfidence().
  • Replace sizeSmallThreshold() with QualityAttributeThresholds.Builder.minSize().
  • Replace sharpnessLowThreshold() with QualityAttributeThresholds.Builder.minSharpness().
  • Replace brightnessLowThreshold() with QualityAttributeThresholds.Builder.brightnessInterval().
  • Replace brightnessHighThreshold() with QualityAttributeThresholds.Builder.brightnessInterval().
  • Replace hotspotsScoreHighThreshold() with QualityAttributeThresholds.Builder.maxHotspotsScore().

Before

val configuration = DocumentAutoCaptureConfiguration.Builder()
  .confidenceLowThreshold(confidenceLowThreshold)
  .sizeSmallThreshold(sizeSmallThreshold)
  .sharpnessLowThreshold(sharpnessLowThreshold)
  .brightnessLowThreshold(brightnessLowThreshold)
  .brightnessHighThreshold(brightnessHighThreshold)
  .hotspotsScoreHighThreshold(hotspotsScoreHighThreshold)
  .build()

After

val configuration = DocumentAutoCaptureConfiguration.Builder()
  .startQualityAttributeThresholds()
  .minConfidence(minConfidence)
  .minSize(minSize)
  .minSharpness(minSharpness)
  .brightnessInterval(IntervalDouble(minBrightness, maxBrightness))
  .maxHotspotsScore(maxHotspotsScore)
  .end()
  .build()

Document Auto Capture Controller component (DocumentAutoCaptureController)

  • Replace calls of onDetectionListener, onCandidateSelectionStartListener and onCaptureListener listeners on DocumentAutoCaptureControllerConfiguration.Builder with handling DocumentAutoCaptureController.ProcessingResult.events property. DocumentAutoCaptureController.ProcessingResult is a return type of process() method.
  • Remove calls of requestCapture(). Use the next instance of DocumentAutoCaptureController.ProcessingResult returned by process() method instead.

Before

DocumentAutoCaptureControllerConfiguration configuration = new DocumentAutoCaptureControllerConfiguration.Builder(context, validators)
    .detectionNormalizedRectangle(detectionNormalizedRectangle)
    .imageParametersNormalizedRectangle(imageParametersNormalizedRectangle)
    .mrzReadingEnabled(mrzReadingEnabled)
    .onDetectionListener(this::handleDetection)
    .onCandidateSelectionStartListener(this::handleCandidateSelectionStart)
    .onCaptureListener(this::handleCapture)
    .build();
DocumentAutoCaptureController documentAutoCaptureController = DocumentAutoCaptureControllerFactory.create(configuration);
//…
documentAutoCaptureController.process(bgraRawImage);
//…
documentAutoCaptureController.requestCapture();

After

DocumentAutoCaptureControllerConfiguration configuration = new DocumentAutoCaptureControllerConfiguration.Builder(context, validators)
    .detectionNormalizedRectangle(detectionNormalizedRectangle)
    .imageParametersNormalizedRectangle(imageParametersNormalizedRectangle)
    .mrzReadingEnabled(mrzReadingEnabled)
    .build();
DocumentAutoCaptureController documentAutoCaptureController = DocumentAutoCaptureControllerFactory.create(configuration);
//…
DocumentAutoCaptureController.ProcessingResult processingResult = documentAutoCaptureController.process(bgraRawImage, timestampMillis);
DocumentAutoCaptureDetection detection = processingResult.getDetection();

if (processingResult.getEvents().contains(DocumentAutoCaptureController.ProcessingResult.Event.CANDIDATE_SELECTION_STARTED)) {
    handleCandidateSelectionStart();
}
if (processingResult.getEvents().contains(DocumentAutoCaptureController.ProcessingResult.Event.CAPTURED)) {
    handleCapture();
}