Speed up SparkScan integration with Agent Skills
Install the Scandit plugin and use the /sparkscan-android skill so that your AI coding agent can integrate, debug, and customize SparkScan on Android 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 on Android, 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. After you change settings, apply them with 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. Added in 8.5.0. |
scanIntention | ScanIntention | SMART | SMART, MANUAL | Sets the scan intention algorithm. SMART_SELECTION is deprecated; use selectionMode set to AUTO instead. |
codeDuplicateFilter | TimeInterval | CodeDuplicate.defaultDuplicateFilter | CodeDuplicate.defaultDuplicateFilter, CodeDuplicate.reportDataAndSymbologyOnlyOnce, 0, or a positive interval | Sets how long a code with the same symbology and data is filtered out as a duplicate. The default depends on scanIntention: smart duplicate filtering with SMART, 1.5 seconds with MANUAL. 0 reports the code 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 | EnumSet<CompositeType> | Sets the composite code types to scan. Also enable their symbologies. Added in 8.3.0. | ||
scanItemDefinitions | List<ScanItemDefinition>? | Configures the settings with the item-based scanning API. When set, enabledSymbologies is ignored. Beta. |
To enable symbologies, use enableSymbologies() or enableSymbology(). For per-symbology options, use getSymbologySettings().
SparkScanViewSettings
SparkScanViewSettings configures the SparkScan view. Set them before you create the SparkScanView. 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. Added in 8.5.0. |
previewBehavior | SparkScanPreviewBehavior | DEFAULT | DEFAULT, PERSISTENT | Sets whether the preview hides after a scan or stays visible. Added in 8.5.0. |
holdToScanEnabled | Boolean | true | Keeps scanning while users hold the trigger button. Ignored when selectionMode is ON. | |
hardwareTriggerEnabled | Boolean | false | Lets users start scanning with the hardware button set in hardwareTriggerKeyCode. Needs API level 28 or higher. | |
hardwareTriggerKeyCode | Int? | A key code | Sets the hardware button. null uses the dedicated button on XCover devices and KeyEvent.KEYCODE_VOLUME_DOWN on other devices. | |
triggerButtonCollapseTimeout | TimeInterval | 5 seconds | A negative value means no timeout | Sets the time after which the view returns to the idle state. |
inactiveStateTimeout | TimeInterval | 10 seconds | 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. | |
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. Added in 8.5.0. |
SparkScanView properties
You set these properties on the 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. If you set it to null, or your delegate returns null, scans get no feedback. | ||
hardwareTriggerSupported | Boolean | Read-only. Whether the device supports hardware buttons. | ||
triggerButtonVisible | Boolean | true | Shows the trigger button. | |
torchControlVisible | Boolean | true | Shows the torch control. It's hidden when defaultTorchState is AUTO. | |
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. Added in 8.5.0. | |
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 | Bitmap? | Sets the image on the trigger button. To use a resource, call setTriggerButtonImage(). | ||
triggerButtonCollapsedColor | Int? | Sets the background color of the collapsed trigger button. | ||
triggerButtonExpandedColor | Int? | Sets the background color of the expanded trigger button. | ||
triggerButtonAnimationColor | Int? | Sets the color of the pulsing animation around the trigger button while the scanner is active. | ||
triggerButtonTintColor | Int? | Sets the tint color of the trigger button. | ||
toolbarBackgroundColor | Int? | null | Sets the background color of the toolbar. | |
toolbarIconActiveTintColor | Int? | null | Sets the color of active toolbar icons. | |
toolbarIconInactiveTintColor | Int? | null | Sets the color of inactive toolbar icons. |
To get toolbar button taps and view state changes, set a UI listener with setListener().
Framework differences
On Android, these options differ from the other SparkScan frameworks:
- You pick the hardware trigger button by its key code.
- Android has no periscope mode. It's available on iOS only.