Files
liangyc cfcfe6df1c fix: 修正插件ID大小写不一致问题
将插件ID从'cordova-plugin-hardwareKey'统一改为'cordova-plugin-hardwarekey',确保所有引用的一致性
2025-06-30 17:04:11 +08:00

882 B

PDA 监听物理按键插件

青春塔项目PDA(AUTOID UTouch X3)设备监听物理按键插件

使用DEMO:https://m.shuto.cn:8681/center/uhf-demo.git

name code
F1 252
音量+ 115
音量- 114
UHF 248
SCAN 249
扫描键(手柄上的) 250

安装插件

cordova plugin add git+https://m.shuto.cn:8681/center/cordova-plugin-hardwarekey.git

引入插件

declare const cordova: any;

使用方法

注册按键监听.

keycode:需要监听的按键keycode数组,可不传,默认监听所有按键

cordova.plugin.hardwareKey.register({
    keycode: [249,250],
    success: res => console.log(res),
    error: err => console.error(err)
});

返回值:{action: 'keyup', keycode: 250}

取消按键监听.

cordova.plugin.hardwareKey.register({
    success: res => console.log(res),
    error: err => console.error(err)
});