BluetoothSerial
BluetoothSerial copied to clipboard
Ionic native bluetooth serial disconnect method
Good evening, use the code below to disconnect on the device:
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. Any others way i can unpair the device? Please advice
This plugin's implementation of disconnect works. I'd suggest writing a small non-ionic app to test connect and disconnect with your app. Make sure you process the callbacks. It's possible the Ionic wrapper for disconnect is broken. If that's the case, submit an issue in their repo, or fix it and submit a pull request to their repo.
Same problem facing this code. Any updates how to solve ?