跳过内容

Getting Started

GitHub

您可以使用我们的AI-Assisted Setup来安装插件。将Capgo技能添加到您的AI工具中,使用以下命令:

终端窗口
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins

然后使用以下提示:

Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-zebra-datawedge` plugin in my project.

如果您更喜欢手动设置,请按照以下命令安装插件并遵循以下平台特定的说明:

  1. 安装插件

    终端窗口
    bun add @capgo/capacitor-zebra-datawedge
  2. 同步本机平台

    终端窗口
    bunx cap sync android
  3. 在设备上配置DataWedge

    • 创建或选择与您的应用程序包相关的Zebra DataWedge配置文件。
    • 启用 Intent Output.
    • 设置 Intent deliveryBroadcast Intent.
    • 选择一个动作,如 app.capgo.zebra.SCAN.
  4. 查看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 启用或禁用数据传输、切换扫描器和触发扫描。

平台范围

平台范围
  • Android:在安装了DataWedge的Zebra设备上完全支持。
  • iOS:不可用,因为DataWedge是Zebra Android特有的。
  • Web:不支持API形状一致性之外的任何内容。

继续从Getting Started

继续从Getting Started

如果您正在使用 入门指南 来规划原生插件工作,连接它与 使用@capgo/capacitor-zebra-datawedge 原生能力在使用@capgo/capacitor-zebra-datawedge Capgo插件目录 Capgo插件目录中的产品工作流程 Capacitor Plugins by Capgo for the implementation detail in Capacitor Plugins by Capgo, 添加或更新插件 添加或更新插件的实现细节,并且 Ionic企业插件替代方案 为 Ionic Enterprise Plugin Alternatives 产品工作流程。