Migrate from 7.x to 8.x
This guide will help you migrate from versions 7.x of the Scandit Smart Data Capture SDK to version 8.x.
Version 8.0 deprecates and removes many APIs from versions 7.x, as well as making many of the existing APIs more intuitive, resulting in a simpler and quicker integration experience.
While not all features and functionalities are impacted, it is likely you will need to modify your app. If you are unsure about how to perform the migration or the feature you are using is not covered in this migration guide, please reach out to our support team.
Updating for Deprecated APIs
If your app is still using version 5.x or 6.x of the Scandit Barcode Scanner SDK, you will need to first migrate to version 6.x and/or 7.x before migrating to version 8.x. Please refer to the migration guide from 5.x to 6.x and migration guide from 6.x to 7.x for more information.
Version 8.0 includes the removal of all APIs that were deprecated throughout the 7.x series. For the simplest migration process, we recommend you:
- Update your app to the latest 7.6.x version. This version includes warnings for all deprecated APIs.
- Address all deprecation warnings in your app.
- Update to version 8.0.
Barcode Capture Changes
Core
In this release, VideoResolution::Auto has been now deprecated. Please use the respective capture mode's recommendedCameraSettings for the best results.
Smart Label Capture
The properties of the LabelFieldDefinition API have been renamed to better reflect their purpose:
| Old Property Name | New Property Name |
|---|---|
pattern | valueRegex |
patterns | valueRegexes |
dataTypePattern | anchorRegex |
dataTypePatterns | anchorRegexes |
SparkScan
In version 7.0, we are introducing the second generation of our ready-to-use barcode scanning UI, SparkScan. This new UI is more intuitive and provides a more modern look and feel, as well as bringing more customization options.
Version 8.0 removes the SparkScan APIs that version 7 deprecated:
- The
SparkScanViewHandModeenum andSparkScanViewSettings.defaultHandMode. - The
SparkScanViewpropertiestorchButtonVisible,handModeButtonVisible,stopCapturingText,startCapturingText,resumeCapturingText,scanningCapturingText,captureButtonBackgroundColor,captureButtonActiveBackgroundColorandcaptureButtonTintColor. - The matching
SparkScanViewDefaultsproperties:DefaultHandModeButtonVisible,DefaultTorchButtonVisible,DefaultStopCapturingText,DefaultStartCapturingText,DefaultResumeCapturingText,DefaultScanningCapturingText,DefaultCaptureButtonActiveBackgroundColor,DefaultCaptureButtonBackgroundColorandDefaultCaptureButtonTintColor.
Version 8.0 also changes the default highlight brush in SparkScan.
Building on the second generation of SparkScan, version 8.0 expands SparkScan beyond barcode scanning to include support for scanning any combination of barcodes and text present on a target. The feature is available in beta at the moment, please contact Scandit Support if you are interested in trying it out.
Cross-Platform Framework Changes (Capacitor, Cordova, React Native, Flutter)
Version 7.6 deprecated the factory methods that create a capture mode or overlay and attach it in the same call, and version 8.0 removes them. Code that still calls them does not compile against 8.0. Create the mode or overlay with its constructor and attach it yourself.
| Removed in 8.0 | Replacement |
|---|---|
forContext(context, settings) on BarcodeCapture, BarcodeBatch, BarcodeCount, BarcodeSelection, BarcodeAr, IdCapture and LabelCapture | The mode's constructor, then context.setMode(mode) |
BarcodeFind.forContext(context, settings) (Capacitor, Cordova, React Native) | new BarcodeFind(settings) |
SparkScan.forSettings(settings) (Capacitor, Cordova, React Native) | new SparkScan(settings) |
Parser.forContextAndFormat(context, dataFormat) | Parser.create(dataFormat) |
The overlay with… factories, such as BarcodeCaptureOverlay.withBarcodeCaptureForView(mode, view) | The overlay's constructor, then view.addOverlay(overlay) |
Before (7.x):
const barcodeCapture = BarcodeCapture.forContext(context, settings);
const overlay = BarcodeCaptureOverlay.withBarcodeCaptureForView(barcodeCapture, view);
After (8.x):
const barcodeCapture = new BarcodeCapture(settings);
context.setMode(barcodeCapture);
const overlay = new BarcodeCaptureOverlay(barcodeCapture);
view.addOverlay(overlay);
setMode removes any mode already attached to the context before adding the new one. Use context.addMode(mode) instead if you need to keep the existing modes.
For Flutter (Dart), the constructors are called without new:
var barcodeCapture = BarcodeCapture(settings);
context.setMode(barcodeCapture);
var overlay = BarcodeCaptureOverlay(barcodeCapture);
view.addOverlay(overlay);
The view factories DataCaptureView.forContext and SparkScanView.forContext are not affected and remain available in 8.0.