1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-26 10:35:50 +01:00

make sure to only reconnect when device is in "waiting for reconnect state"

This commit is contained in:
Andreas Shimokawa 2016-05-29 21:44:43 +02:00
parent af14fb4f90
commit 4533c80c95

View File

@ -32,7 +32,7 @@ public class BluetoothConnectReceiver extends BroadcastReceiver {
GBDevice gbDevice = service.getGBDevice(); GBDevice gbDevice = service.getGBDevice();
if (gbDevice != null) { if (gbDevice != null) {
BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
if (device.getAddress().equals(gbDevice.getAddress())) { if (device.getAddress().equals(gbDevice.getAddress()) && gbDevice.getState() == GBDevice.State.WAITING_FOR_RECONNECT) {
LOG.info("will connect to " + gbDevice.getName()); LOG.info("will connect to " + gbDevice.getName());
GBApplication.deviceService().connect(); GBApplication.deviceService().connect();
} else { } else {