# Android: “peripheral disconnected” if disconnect and then connect

**URL:** <https://forum.ionicframework.com/t/android-peripheral-disconnected-if-disconnect-and-then-connect/209368>\
**Category:** Ionic Native\
**Created:** [May 11, 2021, 11:10am UTC](https://forum.ionicframework.com/t/android-peripheral-disconnected-if-disconnect-and-then-connect/209368 "2021-05-11T11:10:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![JumpGroup](https://avatars.discourse-cdn.com/v4/letter/j/7ab992/32.png) [@JumpGroup](https://forum.ionicframework.com/u/JumpGroup)\
**Post date:** [May 11, 2021, 11:10am UTC](https://forum.ionicframework.com/t/android-peripheral-disconnected-if-disconnect-and-then-connect/209368/1 "2021-05-11T11:10:03Z")

</div>

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

```auto
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

> **[don/cordova-plugin-ble-central - connect](https://github.com/don/cordova-plugin-ble-central#connect)**
>
> Bluetooth Low Energy (BLE) Central plugin for Apache Cordova (aka PhoneGap)

`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.
