DOT Android Palm 9.0.0

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

Migration Steps

Compatibility with DIS

When utilizing DIS for server-side evaluation, ensure compatibility between your DIS version and the corresponding SDK version. Refer to the DIS vs SDKs compatibility table for detailed compatibility information.

SDK initialization

The way DOT SDK libraries are configured has changed.

  • Replace DotSdkConfiguration with DotSdk.Configuration class.
  • Update libraries property of DotSdk.Configuration class.

Before

Libraries were provided as a list of DotLibrary instances.

DotSdkConfiguration(
    //...
    libraries = listOf(
        DotPalmLibrary(),
        //...
    )
)

After

Libraries are now configured via a single Libraries object, with explicit configuration for each DOT SDK library.

DotSdk.Configuration(
    //...
    libraries = Libraries(
        palm = DotPalmLibraryConfiguration(),
        //...
    )
)

UI Palm Auto Capture component

The configuration structure of the PalmAutoCaptureFragment has changed. Existing configuration objects are not compatible with the new API and must be migrated to the new configuration model. Basic migration steps:

  • Replace the method stopAsync(...) with the new method stop().
  • Remove the override of the onProcessed() method and override onUiStateUpdated(uiState: UiState) instead. UiState is a sealed interface, and its implementation UiState.Running replaces the data previously delivered via onProcessed() method.
  • Update configuration provided by provideConfiguration() method.

Before

class BasicPalmAutoCaptureFragment: PalmAutoCaptureFragment {

    override fun provideConfiguration(): Configuration {
        return Configuration(
            cameraFacing = CameraFacing.BACK,
            cameraPreviewScaleType = CameraPreviewScaleType.FIT,
            isTorchEnabled = false,
            isVideoCaptureEnabled = false,
            qualityAttributeThresholds = QualityAttributeThresholdPresets.standard,
            minValidFramesInRowToStartCandidateSelection = 2,
            candidateSelectionDurationMillis = 2000,
            isDetectionLayerVisible = false,
            sessionToken = "...",
            isCameraPreviewVisible = true,
            placeholderType = PlaceholderType.LEFT,
        )
    }

    override fun onProcessed(detection: PalmAutoCaptureDetection) {
        //...
    }

    override fun onCaptured(result: PalmAutoCaptureResult) {
        //...
    }
}

After

class BasicPalmAutoCaptureFragment: PalmAutoCaptureFragment {
  
    override fun provideConfiguration(): Configuration {
        return Configuration(
            base = Configuration(
                common = CommonConfiguration(
                    sessionToken = "...",
                ),
                camera = CameraConfiguration(
                    facing = CameraFacing.BACK,
                    previewScaleType = CameraPreviewScaleType.FILL,
                    isTorchEnabled = false,
                    isVideoCaptureEnabled = true,
                    isPreviewVisible = true,
                ),
                autoCapture = AutoCaptureConfiguration(
                    minValidSamplesInRowToStartCandidateSelection = 2,
                    candidateSelectionDurationMillis = 2000,
                ),
                qualityAttributeThresholds = QualityAttributeThresholds.Presets.standard,
            ),
            placeholder = Placeholder.Visible(
                type = Placeholder.Visible.Type.LEFT,
            ),
            isDetectionLayerVisible = false,
        )
    }

    override fun onUiStateUpdated(uiState: UiState) {
        if (uiState is UiState.Running) {
            //...
        }
    }

    override fun onFinished(result: PalmAutoCaptureResult) {
        //...
    }
}

Image

Several changes were applied to image-related functionality.

  • BgraRawImage has been replaced by the generic Image class.
  • BgraRawImageFactory has been replaced by ImageFactory.

Before

val image: BgraRawImage = BgraRawImageFactory.create(imageProxy)

After

val image: Image = ImageFactory.createBgraRawImage(imageProxy)