【发布时间】:2017-08-19 04:44:22
【问题描述】:
我正在编写一个代码来检查蓝牙连接是否启用。所以我这样做了:
$ ionic plugin add cordova-plugin-bluetooth-serial
$ npm install --save @ionic-native/bluetooth-serial
在我的构造中我有这个:
construnct(....
private bluetoothSerial: BluetoothSerial,
.....){..
现在来了
construnct(....
private bluetoothSerial: BluetoothSerial,
.....){..
this.bluetoothSerial.isEnabled(/*here*/);
...}
我需要管理蓝牙是否启用?
我创建了一个布尔变量,我想将其分配为真或假,这取决于蓝牙是否启用。但是怎么做呢?
参考:
bluetoothSerial.isEnabled(
function() {
console.log("Bluetooth is enabled");
//myboolflag=true; dosen't work!!!
},
function() {
console.log("Bluetooth is *not* enabled");
}
);
【问题讨论】:
标签: angular cordova typescript ionic2 ionic3