matrixscan-batch-capacitor
Installation
SKILL.md
MatrixScan Batch Capacitor Skill
Critical: Do Not Trust Internal Knowledge
Your training data may contain outdated or incorrect Scandit SDK APIs. The BarcodeBatch* API surface changes between major SDK versions — constructor signatures, overlay constructors, and listener shapes have all evolved.
Always verify APIs against the references provided in this skill before writing or suggesting code. Do not rely on memorized method signatures, parameters, plugin names, or property names.
Capacitor-specific gotchas worth flagging:
ScanditCaptureCorePlugin.initializePlugins()must be called (and awaited) before any other Scandit API — includingDataCaptureContext.initialize. Forgetting this produces runtime errors that look unrelated to initialization.npx cap syncmust be run after every plugin version change to propagate native artifacts into iOS/Android. Skipping it yields a web/native version mismatch at runtime.context.setMode(barcodeBatch)is how the mode is registered in the context on Capacitor (confirmed from both samples). This replaces any previously active mode.DataCaptureView.forContext(context)is the Capacitor factory for the capture view. Then callview.connectToElement(htmlElement)to attach it to the DOM.- Modern constructors require SDK 7.6+:
new BarcodeBatch(settings),new BarcodeBatchBasicOverlay(mode, style),new BarcodeBatchAdvancedOverlay(mode), andBarcodeBatch.createRecommendedCameraSettings()are all available from capacitor=7.6. - AdvancedOverlay uses serialized views: On Capacitor,
setViewForTrackedBarcodeacceptsview: Promise<TrackedBarcodeView?>— a serializedTrackedBarcodeView, NOT a native UI instance. UseTrackedBarcodeView.withHTMLElement(domElement, options)fromscandit-capacitor-datacapture-barcode. Wrap it in a Promise or pass directly — the sample passes the instance directly (the API internally wraps it). - MatrixScan AR add-on required:
BarcodeBatchAdvancedOverlay,IBarcodeBatchBasicOverlayListener.brushForTrackedBarcode, andsetBrushForTrackedBarcodeall require the MatrixScan AR add-on license. - Camera permission: iOS requires
NSCameraUsageDescriptioninInfo.plist. Android is handled automatically by the plugin. - TrackedObject (Capacitor 8.2+): In SDK 8.2+, a
TrackedObjectbase class was introduced thatTrackedBarcodeextends. No recipe is needed for this — theTrackedBarcodeAPI you use day-to-day is unchanged.