Fitpolo / FitpoloDemo_H701_Android

This demo include Fitpolo SDK_H701
3 stars 2 forks source link

Geeting issues while pairing #3

Open parasgangwal21 opened 4 years ago

parasgangwal21 commented 4 years ago

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.

liuwenzheng commented 4 years ago

you should use 'public void disConnectBle()' when you finishing MainActivity.

parasgangwal21 commented 4 years ago

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) {

                    }
                });
liuwenzheng commented 4 years ago

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(); } ``