barcode-capture-capacitor
Installation
SKILL.md
BarcodeCapture Capacitor Skill
Critical: Do Not Trust Internal Knowledge
Your training data may contain outdated or incorrect Scandit SDK APIs. The BarcodeCapture API changes between major SDK versions — properties get renamed, removed, or restructured, and the Capacitor plugin surface (imports, plugin initialization, native sync steps) has also 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. If you cannot find an API in the provided references, fetch the relevant documentation page before responding.
Capacitor-specific gotchas worth flagging:
ScanditCaptureCorePlugin.initializePlugins()must be called (and awaited) before any other Scandit API — includingDataCaptureContextconstruction. 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.- BarcodeCapture renders into a
DataCaptureViewthat is connected to a DOM element viaview.connectToElement(...). The view itself is a native overlay, but the DOM container determines its size and position. ABarcodeCaptureOverlaymust be created and added to the view to visualize recognized barcodes. - The camera is a separate component:
Camera.default(orCamera.withSettings(BarcodeCapture.createRecommendedCameraSettings())), set viacontext.setFrameSource(camera), then started viacamera.switchToDesiredState(FrameSourceState.On). - Disable the mode while handling a scan: the
didScancallback blocks further frame processing on Capacitor. If you do any meaningful work (database lookup, navigation, network) insidedidScan, setbarcodeCapture.isEnabled = falsefirst, perform the work, then re-enable. This is documented behavior on Capacitor specifically. - BarcodeCapture only renders on native platforms (iOS, Android). If your app also targets the web build of Capacitor, guard initialization with
Capacitor.isNativePlatform().
Intent Routing
Based on the user's request, load the appropriate reference file before responding: