Attempt to fix reconnection problems after being away from the Mi Band

*untested*
This commit is contained in:
cpfeiffer 2015-08-04 22:03:10 +02:00
parent c407ed1a76
commit bdc9e70e6e
1 changed files with 3 additions and 5 deletions

View File

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