@cenong wrote:
I have connected to bluetooth device with code below:
let alert = this.alertCtrl.create({
title: ‘Connect’,
message: ‘Do you want to connect with?’,
buttons: [
{
text: ‘Cancel’,
role: ‘cancel’,
handler: () => {
console.log(‘Cancel clicked’);
}
},
{
text: ‘Connect’,
handler: () => {
this.bluetoothSerial.connect(address).subscribe(this.success, this.fail);} }
]
});
alert.present();
it able to connected with no issue.When i try to disconnect the device and connect another with code below:
let alert = this.alertCtrl.create({
title: ‘Disconnect?’,
message: ‘Do you want to Disconnect?’,
buttons: [
{
text: ‘Cancel’,
role: ‘cancel’,
handler: () => {
console.log(‘Cancel clicked’);
}
},
{
text: ‘Disconnect’,
handler: () => {
this.bluetoothSerial.disconnect();
console.log(‘Disconnect clicked’);
}
}
]
});
alert.present();
i able to print “Disconnect clicked” but no response the device still connected. I have to go to android setting screen bluetooth to unpair the devices. “this.bluetoothSerial.disconnect();” this code look like not working. Please advice
Posts: 1
Participants: 1