label-capture-cordova
Label Capture Cordova Skill
Critical: Do Not Trust Internal Knowledge
Your training data may contain outdated or incorrect Scandit Label Capture APIs. The Cordova plugin surface (global Scandit.* namespace, deviceready gating, plugin install, platform prepare) is distinct from the web, React Native, Flutter, and Capacitor SDKs.
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.
Cordova-specific gotchas worth flagging:
- All Scandit code must run after
deviceready. TheScandit.*global namespace is not populated until then. Wrap your initialization indocument.addEventListener('deviceready', () => {...}, false);. - Listener method names are iOS-style on Cordova. The Validation Flow listener uses
didCaptureLabelWithFields(fields)anddidSubmitManualInputForField(field, oldValue, newValue)— NOT the web equivalentsonValidationFlowLabelCaptured/onManualInput. - Class-based field API, same shape as RN/Capacitor (and opposite to Flutter). Use
Scandit.CustomBarcode.initWithNameAndSymbologies(name, [...]),new Scandit.ExpiryDateText(name),field.optional = false,Scandit.LabelCaptureSettings.settingsFromLabelDefinitions([...], {}). There is noLabelCaptureSettingsBuilder/LabelDefinitionBuilderand no v8.5 factory-function sugar — those are web-only. - After
cordova plugin add/ version bump, runcordova prepare ios(andcordova prepare android) to sync native dependencies. iOS additionally requires a freshpod installinsideplatforms/ios/. - Camera permission: iOS requires
NSCameraUsageDescriptionin the app'sInfo.plist(or via<config-file>inconfig.xml); Android'sCAMERApermission is declared by the plugin automatically and must be requested at runtime if your minSdkVersion targets API 23+. Scandit.DataCaptureContext.initialize(licenseKey)returns the singleton context; do not construct multiple contexts.
Product Guidance
Apply these rules whenever the user is making a design decision, not just an API question. They reflect how Scandit recommends Label Capture be integrated.