Open parasgangwal21 opened 4 years ago
you should use 'public void disConnectBle()' when you finishing MainActivity.
tried using MokoSupport.getInstance().disConnectBle(); but not worked when trying to connect again using below code always going in onDisConnected method. Please provide steps to disconnect and connect again(pair) MokoSupport.getInstance().connDevice(mContext, device.address, new MokoConnStateCallback() { @Override public void onConnectSuccess() {
preference.putString("band", device.address);
}
@Override
public void onDisConnected() {
}
@Override
public void onConnTimeout(int reConnCount) {
}
});
Maybe the device was reconnected.When the device is disconnected, it is reconnected twice.I updated the code to close the reconnection before using the disconnectBle() method.
`` MokoService.java
public void disConnectBle() { MokoSupport.getInstance().setReconnectCount(0); MokoSupport.getInstance().disConnectBle(); } ``
I am using Fitpolo H701 Band. I am able to search, connect and pair to band using sample code but I am getting issues if I close MainActivity (finish) then app goes in background and when I open it again it will not connect. I need to kill app from stack and then it will pair. So, What I need to be done for pairing(I have band address in shared preference) or what need to be done at the time of finishing MainActivity so that it will work perfectly.