Hi
It’s an Android problem.
I need, after BLE.write, to disconnect the device and connect it again, so I call this function after BLE.write done successfully
reconnectDevice(device) {
BLE.disconnect(device.id).then(() => {
BLE.connect(device.id).subscribe(
peripheralData => {
this.device = peripheralData;
localStorage.setItem('device', JSON.stringify(this.device));
error => {
console.log('Error: ', error);
}
}
);
});
}
The problem is that BLE.connect always returns the failure callback saying “peripheral disconnected” and I don’t understand why.
as the doc says
The disconnect callback is not called when the application calls ble.disconnect. The disconnect callback is how your app knows the peripheral inintiated a disconnect.
I saw other issues about this but I saw that the problem was solved with a commit. Btw I still have this problem and I’ve added to my project the last plugin version.
Maybe I call the two functions wrong? on ios this code works smoothly.