设备
获取设备电池信息
ymx.getBatteryInfo() .then(res => { alert(JSON.stringify(res)); }); 复制
ymx.getBatteryInfo() .then(res => { alert(JSON.stringify(res)); });
获取是否保持常亮状态
ymx.getKeepScreenOn() .then(res => { alert(res.isKeepScreenOn ? '常亮' : '非常亮'); }); 复制
ymx.getKeepScreenOn() .then(res => { alert(res.isKeepScreenOn ? '常亮' : '非常亮'); });
获取屏幕亮度
ymx.getScreenBrightness() .then(res => { alert(JSON.stringify(res)); }); 复制
ymx.getScreenBrightness() .then(res => { alert(JSON.stringify(res)); });
拨打电话
ymx.makePhoneCall({ // 示例号码 phoneNumber: '138001234'}); 复制
ymx.makePhoneCall({ // 示例号码 phoneNumber: '138001234'});
调起客户端扫码界面进行扫码
ymx.scanCode({ scanType: ['barCode', 'qrCode']}).then(res => { alert(JSON.stringify(res));}); 复制
ymx.scanCode({ scanType: ['barCode', 'qrCode']}).then(res => { alert(JSON.stringify(res));});
ymx.scanCode({ onlyFromCamera: true}).then(res => { alert(JSON.stringify(res));}); 复制
ymx.scanCode({ onlyFromCamera: true}).then(res => { alert(JSON.stringify(res));});
设置是否保持常亮状态
ymx.setKeepScreenOn({ keepScreenOn: true}).then(() => { alert('已开启屏幕常亮');}); 复制
ymx.setKeepScreenOn({ keepScreenOn: true}).then(() => { alert('已开启屏幕常亮');});
ymx.setKeepScreenOn({ keepScreenOn: false}).then(() => { alert('已关闭屏幕常亮');}); 复制
ymx.setKeepScreenOn({ keepScreenOn: false}).then(() => { alert('已关闭屏幕常亮');});
设置屏幕亮度
ymx.setScreenBrightness({ value: 0.8}).then(() => { alert('已设置');}); 复制
ymx.setScreenBrightness({ value: 0.8}).then(() => { alert('已设置');});
使手机发生较长时间的振动(400 ms)
ymx.vibrateLong(); 复制
ymx.vibrateLong();
使手机发生较短时间的振动(15 ms)
ymx.vibrateShort({ type: 'medium'}); 复制
ymx.vibrateShort({ type: 'medium'});
设备