From bdc9e70e6e399135d5d80bd462d48dd947c592e5 Mon Sep 17 00:00:00 2001 From: cpfeiffer Date: Tue, 4 Aug 2015 22:03:10 +0200 Subject: [PATCH] Attempt to fix reconnection problems after being away from the Mi Band *untested* --- .../gadgetbridge/service/btle/BtLEQueue.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/btle/BtLEQueue.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/btle/BtLEQueue.java index 0c0a08b1..6f2c4974 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/btle/BtLEQueue.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/btle/BtLEQueue.java @@ -147,13 +147,11 @@ public final class BtLEQueue { } LOG.info("Attempting to connect to " + mGbDevice.getName()); BluetoothDevice remoteDevice = mBluetoothAdapter.getRemoteDevice(mGbDevice.getAddress()); - boolean result = false; synchronized (mGattMonitor) { - mBluetoothGatt = remoteDevice.connectGatt(mContext, false, internalGattCallback); - result = mBluetoothGatt.connect(); + mBluetoothGatt = remoteDevice.connectGatt(mContext, true, internalGattCallback); } - setDeviceConnectionState(result ? State.CONNECTING : State.NOT_CONNECTED); - return result; + setDeviceConnectionState(State.CONNECTING); + return true; } private void setDeviceConnectionState(State newState) {