【发布时间】:2021-06-28 18:45:49
【问题描述】:
我正在尝试使用此插件搜索蓝牙设备:
https://github.com/nativescript-community/ble
我总是尝试使用此代码搜索设备:
doStartScanning(){
{
this.isLoading = true;
// reset the array
this.observablePeripheralArray.splice(0, this.observablePeripheralArray.length);
this.bluetooth.startScanning(
{
filters: [{serviceUUID:'180d'}], // pass an empty array to scan for all services
seconds: 4, // passing in seconds makes the plugin stop scanning after <seconds> seconds
onDiscovered: function (peripheral) {
this.observablePeripheralArray.push(fromObject(peripheral));
}
}
).then(function() {
this.isLoading = false;
},
function (err) {
this.isLoading = false;
alert({
title: "Whoops!",
message: err,
okButtonText: "OK, got it"
});
});
};
}
我收到此错误:
JS: Unhandled Promise rejection: Permission denied ; Zone: <root> ; Task: null ; Value: Permission denied undefined
蓝牙已启用并从手机授予权限
【问题讨论】: