Getting Started
此内容尚不支持你的语言。
-
Install the plugin
Terminal window npm i @capgo/capacitor-zebra-datawedgeTerminal window pnpm add @capgo/capacitor-zebra-datawedgeTerminal window yarn add @capgo/capacitor-zebra-datawedgeTerminal window bun add @capgo/capacitor-zebra-datawedge -
Sync native platforms
Terminal window npx cap sync androidTerminal window pnpm cap sync androidTerminal window yarn cap sync androidTerminal window bunx cap sync android -
Configure DataWedge on the device
- Create or pick a Zebra DataWedge profile associated with your app package.
- Enable
Intent Output. - Set
Intent deliverytoBroadcast Intent. - Choose an action such as
app.capgo.zebra.SCAN.
-
Review Android behavior
- Read the Android notes before enabling soft triggers in production.
Basic setup
Section titled “Basic setup”import { DataWedgeConfigMode, DataWedgePlugin, ZebraConfiguration, ZebraDataWedge, ZebraRuntime,} from '@capgo/capacitor-zebra-datawedge';
const intentAction = 'app.capgo.zebra.SCAN';
await ZebraConfiguration.setConfig({ profileName: 'CapgoZebraProfile', profileEnabled: true, configMode: DataWedgeConfigMode.CREATE_IF_NOT_EXIST, appList: [ { packageName: 'com.example.app', activityList: ['*'], }, ], pluginConfigs: [ { pluginName: DataWedgePlugin.BARCODE, resetConfig: true, paramList: { scanner_selection: 'auto', scanner_input_enabled: 'true', }, }, { pluginName: DataWedgePlugin.INTENT, resetConfig: true, paramList: { intent_output_enabled: 'true', intent_action: intentAction, intent_delivery: 2, }, }, ],});
await ZebraDataWedge.addListener('scan', (result) => { console.log('Scanned', result.data, result.labelType);});
const result = await ZebraRuntime.softScanTrigger(intentAction);console.log(result.data);Main runtime groups
Section titled “Main runtime groups”ZebraConfigurationmanages profiles and disabled-app settings.ZebraNotificationregisters for DataWedge notification broadcasts such as scanner status and profile switches.ZebraQueryreads active profiles, associated apps, scanner status, scanner lists, and version info.ZebraRuntimeenables or disables DataWedge, switches scanners, and triggers scans.
Platform scope
Section titled “Platform scope”- Android: fully supported on Zebra devices with DataWedge installed.
- iOS: not available because DataWedge is Zebra Android specific.
- Web: not available beyond API shape parity.