跳过内容

开始使用

  1. 安装插件

    __CAPGO_KEEP_0__
    bun add @capgo/capacitor-zebra-datawedge
  2. 同步本机平台

    __CAPGO_KEEP_0__
    bunx cap sync android
  3. 配置设备上的DataWedge

    • 创建或选择一个与您的应用程序包相关的Zebra DataWedge配置文件。
    • 启用 Intent Output.
    • 设置 Intent deliveryBroadcast Intent.
    • 选择一个动作,如 app.capgo.zebra.SCAN.
  4. Review Android behavior

    • 阅读 Android 在生产环境中启用软触发器之前,请阅读

基本设置

基本设置
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);

主运行时组

主运行时组
  • ZebraConfiguration 负责管理配置文件和禁用的应用设置。
  • ZebraNotification 注册数据韦奇数据广播,例如扫描器状态和配置文件切换。
  • ZebraQuery 读取活动配置文件、关联应用、扫描器状态、扫描器列表和版本信息。
  • ZebraRuntime 启用或禁用 DataWedge,切换扫描器,触发扫描。
  • iOS:不可用,因为 DataWedge 是 Zebra Android 特有的。
  • Web:不支持超出 __CAPGO_KEEP_0__ 形状平衡。
  • Web: not available beyond API shape parity.