From 802e9a82359cc2fea311d8112c4464711971e391 Mon Sep 17 00:00:00 2001 From: cpfeiffer Date: Sat, 9 Apr 2016 09:53:03 +0200 Subject: [PATCH] OK, revert to connectGatt(false), connect often does not work with true #249 --- .../gadgetbridge/service/btle/BtLEQueue.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 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 4839a992..71d1beaf 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 @@ -157,12 +157,13 @@ public final class BtLEQueue { LOG.info("Attempting to connect to " + mGbDevice.getName()); mBluetoothAdapter.cancelDiscovery(); BluetoothDevice remoteDevice = mBluetoothAdapter.getRemoteDevice(mGbDevice.getAddress()); - boolean result; +// boolean result; synchronized (mGattMonitor) { - mBluetoothGatt = remoteDevice.connectGatt(mContext, true, internalGattCallback); - result = mBluetoothGatt.connect(); + // connectGatt with true doesn't really work ;( too often connection problems + mBluetoothGatt = remoteDevice.connectGatt(mContext, false, internalGattCallback); +// result = mBluetoothGatt.connect(); } -// boolean result = mBluetoothGatt != null; + boolean result = mBluetoothGatt != null; if (result) { setDeviceConnectionState(State.CONNECTING); }