BluetoothSerial icon indicating copy to clipboard operation
BluetoothSerial copied to clipboard

Ionic native bluetooth serial disconnect method

Open ThauanyCorrea opened this issue 6 years ago • 2 comments

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

ThauanyCorrea avatar Jan 31 '18 06:01 ThauanyCorrea

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.

don avatar May 29 '18 21:05 don

Same problem facing this code. Any updates how to solve ?

fihamzuher avatar Dec 05 '18 11:12 fihamzuher