Skip to main content
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/skills

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

NameTypeDefaultValuesWhat it does
selectionModeSelectionModeAUTOAUTO, OFF, ONSets whether users confirm the aimed barcode before it's scanned.
scanIntentionScanIntentionSMARTSMART, MANUALSets the scan intention algorithm. SMART_SELECTION is deprecated; use selectionMode set to AUTO instead.
codeDuplicateFilterLong-2-2, -1, 0, or a positive duration in millisecondsSets 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.
batterySavingBatterySavingModeAUTOAUTO, ON, OFFSets the battery saving mode. AUTO turns it on when battery use is higher than usual.
enabledSymbologiesSet<Symbology>EmptyRead-only. The enabled symbologies. All symbologies are off by default.
enabledCompositeTypesSet<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.

NameTypeDefaultValuesWhat it does
scanningBehaviorSparkScanScanningBehaviorSINGLESINGLE, CONTINUOUSSets whether users scan one barcode per trigger or scan continuously.
previewBehaviorSparkScanPreviewBehaviorDEFAULTDEFAULT, PERSISTENTSets whether the preview hides after a scan or stays visible.
holdToScanEnabledBooleantrueKeeps scanning while users hold the trigger button. Ignored when selectionMode is ON.
hardwareTriggerEnabledBooleanLets users start scanning with a hardware button.
hardwareTriggerKeyCodeInt?null: the dedicated button on XCover devices, or volume down on other devicesSets the hardware button. Applies on Android only.
triggerButtonCollapseTimeoutLong5 secondsMilliseconds. A negative value means no timeoutSets the time after which the view returns to the idle state.
inactiveStateTimeoutLong10 secondsMillisecondsSets the time after which capturing stops.
soundEnabledBooleantruePlays a sound as scan feedback.
hapticEnabledBooleantrueVibrates as scan feedback.
visualFeedbackEnabledBooleantrueShows visual feedback on each scan.
defaultTorchStateTorchStateOFFOFF, ON, AUTOSets the torch state when scanning starts.
defaultCameraPositionCameraPositionWORLD_FACINGWORLD_FACING, USER_FACING, UNSPECIFIEDSets the camera that scanning starts with. Beta.
defaultMiniPreviewSizeSparkScanMiniPreviewSizeREGULARREGULAR, EXPANDEDSets the size of the mini preview.
zoomFactorOutFloat1Sets the camera zoom factor.
zoomFactorInFloat2Sets the zoom factor after users tap the zoom switch control.
periscopeModeEnabledBooleanfalseMirrors the camera feed for use with a periscope device. iOS only.
toastSettingsSparkScanToastSettingsSets the toast messages and their colors.
selectionModeCandidateBrushBrush?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.

NameTypeDefaultValuesWhat it does
feedbackDelegateSparkScanFeedbackDelegate?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.
uiListenerSparkScanViewUiListener?Sets the listener for toolbar button taps and view state changes.
hardwareTriggerSupportedBooleanRead-only. Whether the device supports hardware buttons: true on Android API level 28 or higher.
triggerButtonVisibleBooleantrueShows the trigger button.
torchControlVisibleBooleantrueShows the torch control.
zoomSwitchControlVisibleBooleantrueShows the zoom switch control.
previewSizeControlVisibleBooleantrueShows the mini preview size control.
previewCloseControlVisibleBooleantrueShows the mini preview close control.
scanningBehaviorButtonVisibleBooleanfalseShows the scanning behavior button in the toolbar.
selectionModeButtonVisibleBooleanfalseShows the selection mode button, which switches selectionMode between ON and OFF.
cameraSwitchButtonVisibleBooleanfalseShows the camera switch button. Beta.
barcodeCountButtonVisibleBooleanfalseShows the MatrixScan Count button in the toolbar.
barcodeFindButtonVisibleBooleanfalseShows the MatrixScan Find button in the toolbar.
labelCaptureButtonVisibleBooleanfalseShows the Smart Label Capture button in the toolbar.
triggerButtonImageInputImage?Sets the image on the trigger button.
triggerButtonCollapsedColorColor?Sets the background color of the collapsed trigger button.
triggerButtonExpandedColorColor?Sets the background color of the expanded trigger button.
triggerButtonAnimationColorColor?Sets the color of the pulsing animation around the trigger button while the scanner is active.
triggerButtonTintColorColor?Sets the tint color of the trigger button.
toolbarBackgroundColorColor?nullSets the background color of the toolbar.
toolbarIconActiveTintColorColor?nullSets the color of active toolbar icons.
toolbarIconInactiveTintColorColor?nullSets 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, scanningBehavior and previewBehavior were added in 8.5.0.
  • In the Compose SparkScanView, scanningBehaviorButtonVisible, selectionModeButtonVisible, cameraSwitchButtonVisible and the deprecated targetModeButtonVisible default to true. On the imperative view and on the other frameworks, they default to false.
  • periscopeModeEnabled works on iOS only.

Next step​

Choosing which barcode types to scan