Speed up SparkScan integration with Agent Skills
Install the Scandit plugin and use the /sparkscan-kmp skill so that your AI coding agent can integrate, debug, and customize SparkScan on Kotlin Multiplatform following Scandit's recommended patterns. More info →
Run the following command in your project directory. It detects the supported coding agents you have installed and adds the Scandit plugin to each. Re-run it to update.
npx plugins add scandit/skillsPrefer to set it up yourself? Manual installation steps for each agent →
SparkScan settings reference
This page lists the SparkScan settings and view properties in Kotlin Multiplatform, with their defaults and allowed values as the API reference states them. A blank default means the API reference states none. For what the workflow settings do for your users, see How SparkScan works.
Options
SparkScanSettings
SparkScanSettings configures the capture mode: which barcodes it scans and how. Create it with SparkScanSettings.sparkScanSettings(), and pass it to the SparkScan constructor or to SparkScan.applySettings().
| Name | Type | Default | Values | What it does |
|---|---|---|---|---|
selectionMode | SelectionMode | AUTO | AUTO, OFF, ON | Sets whether users confirm the aimed barcode before it's scanned. |
scanIntention | ScanIntention | SMART | SMART, MANUAL | Sets the scan intention algorithm. SMART_SELECTION is deprecated; use selectionMode set to AUTO instead. |
codeDuplicateFilter | Long | -2 | -2, -1, 0, or a positive duration in milliseconds | Sets how long a code with the same symbology and data is filtered out as a duplicate. -2 depends on scanIntention: smart duplicate filtering with SMART, 1.5 seconds with MANUAL. -1 reports a code only once until scanning stops. 0 reports it every time. If you keep the default and turn the selection mode On, SparkScan doesn't filter duplicates, so users can select the same barcode again. |
batterySaving | BatterySavingMode | AUTO | AUTO, ON, OFF | Sets the battery saving mode. AUTO turns it on when battery use is higher than usual. |
enabledSymbologies | Set<Symbology> | Empty | Read-only. The enabled symbologies. All symbologies are off by default. | |
enabledCompositeTypes | Set<CompositeType> | Sets the composite code types to scan. Also enable their symbologies with enableSymbologiesForCompositeTypes(). |
To enable symbologies, use enableSymbologies() or enableSymbology(). For per-symbology options, use getSymbologySettings().
SparkScanViewSettings
SparkScanViewSettings configures the SparkScan view. Create it with SparkScanViewSettings.sparkScanViewSettings() and set it before you create the view. On Android, changes after that don't apply to the view.
| Name | Type | Default | Values | What it does |
|---|---|---|---|---|
scanningBehavior | SparkScanScanningBehavior | SINGLE | SINGLE, CONTINUOUS | Sets whether users scan one barcode per trigger or scan continuously. |
previewBehavior | SparkScanPreviewBehavior | DEFAULT | DEFAULT, PERSISTENT | Sets whether the preview hides after a scan or stays visible. |
holdToScanEnabled | Boolean | true | Keeps scanning while users hold the trigger button. Ignored when selectionMode is ON. | |
hardwareTriggerEnabled | Boolean | Lets users start scanning with a hardware button. | ||
hardwareTriggerKeyCode | Int? | null: the dedicated button on XCover devices, or volume down on other devices | Sets the hardware button. Applies on Android only. | |
triggerButtonCollapseTimeout | Long | 5 seconds | Milliseconds. A negative value means no timeout | Sets the time after which the view returns to the idle state. |
inactiveStateTimeout | Long | 10 seconds | Milliseconds | Sets the time after which capturing stops. |
soundEnabled | Boolean | true | Plays a sound as scan feedback. | |
hapticEnabled | Boolean | true | Vibrates as scan feedback. | |
visualFeedbackEnabled | Boolean | true | Shows visual feedback on each scan. | |
defaultTorchState | TorchState | OFF | OFF, ON, AUTO | Sets the torch state when scanning starts. |
defaultCameraPosition | CameraPosition | WORLD_FACING | WORLD_FACING, USER_FACING, UNSPECIFIED | Sets the camera that scanning starts with. Beta. |
defaultMiniPreviewSize | SparkScanMiniPreviewSize | REGULAR | REGULAR, EXPANDED | Sets the size of the mini preview. |
zoomFactorOut | Float | 1 | Sets the camera zoom factor. | |
zoomFactorIn | Float | 2 | Sets the zoom factor after users tap the zoom switch control. | |
periscopeModeEnabled | Boolean | false | Mirrors the camera feed for use with a periscope device. iOS only. | |
toastSettings | SparkScanToastSettings | Sets the toast messages and their colors. | ||
selectionModeCandidateBrush | Brush? | Sets the brush for candidate barcodes when selectionMode is AUTO. null uses the default brush. |
SparkScanView properties
You set these properties on the imperative SparkScanView after you create it.
| Name | Type | Default | Values | What it does |
|---|---|---|---|---|
feedbackDelegate | SparkScanFeedbackDelegate? | Sets the delegate that returns success or error feedback for each barcode. By default, every scan gets success feedback. On Android, if you set it to null, scans get no feedback. | ||
uiListener | SparkScanViewUiListener? | Sets the listener for toolbar button taps and view state changes. | ||
hardwareTriggerSupported | Boolean | Read-only. Whether the device supports hardware buttons: true on Android API level 28 or higher. | ||
triggerButtonVisible | Boolean | true | Shows the trigger button. | |
torchControlVisible | Boolean | true | Shows the torch control. | |
zoomSwitchControlVisible | Boolean | true | Shows the zoom switch control. | |
previewSizeControlVisible | Boolean | true | Shows the mini preview size control. | |
previewCloseControlVisible | Boolean | true | Shows the mini preview close control. | |
scanningBehaviorButtonVisible | Boolean | false | Shows the scanning behavior button in the toolbar. | |
selectionModeButtonVisible | Boolean | false | Shows the selection mode button, which switches selectionMode between ON and OFF. | |
cameraSwitchButtonVisible | Boolean | false | Shows the camera switch button. Beta. | |
barcodeCountButtonVisible | Boolean | false | Shows the MatrixScan Count button in the toolbar. | |
barcodeFindButtonVisible | Boolean | false | Shows the MatrixScan Find button in the toolbar. | |
labelCaptureButtonVisible | Boolean | false | Shows the Smart Label Capture button in the toolbar. | |
triggerButtonImage | InputImage? | Sets the image on the trigger button. | ||
triggerButtonCollapsedColor | Color? | Sets the background color of the collapsed trigger button. | ||
triggerButtonExpandedColor | Color? | Sets the background color of the expanded trigger button. | ||
triggerButtonAnimationColor | Color? | Sets the color of the pulsing animation around the trigger button while the scanner is active. | ||
triggerButtonTintColor | Color? | Sets the tint color of the trigger button. | ||
toolbarBackgroundColor | Color? | null | Sets the background color of the toolbar. | |
toolbarIconActiveTintColor | Color? | null | Sets the color of active toolbar icons. | |
toolbarIconInactiveTintColor | Color? | null | Sets the color of inactive toolbar icons. |
The Compose SparkScanView takes the visibility properties as parameters. Some of their defaults differ, as the framework differences list.
Framework differences
In Kotlin Multiplatform, these options differ from the other SparkScan frameworks:
- Every member was added in 8.6.0, the first Kotlin Multiplatform release. On iOS, Android and Web,
selectionMode,scanningBehaviorandpreviewBehaviorwere added in 8.5.0. - In the Compose
SparkScanView,scanningBehaviorButtonVisible,selectionModeButtonVisible,cameraSwitchButtonVisibleand the deprecatedtargetModeButtonVisibledefault totrue. On the imperative view and on the other frameworks, they default tofalse. periscopeModeEnabledworks on iOS only.