Getting Started
Ce contenu n'est pas encore disponible dans votre langue.
-
Install the plugin
Fenêtre de terminal npm i @capgo/capacitor-zebra-datawedgeFenêtre de terminal pnpm add @capgo/capacitor-zebra-datawedgeFenêtre de terminal yarn add @capgo/capacitor-zebra-datawedgeFenêtre de terminal bun add @capgo/capacitor-zebra-datawedge -
Sync native platforms
Fenêtre de terminal npx cap sync androidFenêtre de terminal pnpm cap sync androidFenêtre de terminal yarn cap sync androidFenêtre de terminal 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.