老家三轮车
老家三轮车
  • 发布:2022-03-31 11:07
  • 更新:2025-03-04 15:11
  • 阅读:498

蓝牙打印机

分类:HTML5+

H5+APP使用mui.js连接蓝牙打印机

0 关注 分享

要回复文章请先登录注册

3***@qq.com

3***@qq.com

1、在Android项目的AndroidManifest.xml文件中,需声明以下权限:
2、运行时还需要请求权限
function requestPermissions() {
var permissions = [
"android.permission.BLUETOOTH",
"android.permission.BLUETOOTH_ADMIN",
"android.permission.BLUETOOTH_SCAN",
"android.permission.BLUETOOTH_CONNECT"
];
plus.android.requestPermissions(
permissions,
function(result) {
// 权限申请成功后的回调
console.log("权限申请成功");
},
function(error) {
console.error("权限申请失败:" + error.message);
}
);
}
2025-03-04 15:11
8***@qq.com

8***@qq.com

运行后报错啊
Uncaught java.lang.SecurityException: Need android.permission.BLUETOOTH_SCAN permission for android.content.AttributionSource@8a1bcf4c: Starting discovery.;at android.bluetooth.BluetoothAdapter.startDiscovery at printer.html:1
2023-07-27 16:27