diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/BluetoothCommunicationService.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/BluetoothCommunicationService.java index 12115a0b4..8407cbe49 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/BluetoothCommunicationService.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/BluetoothCommunicationService.java @@ -256,15 +256,16 @@ public class BluetoothCommunicationService extends Service { BluetoothDevice btDevice = mBtAdapter.getRemoteDevice(btDeviceAddress); if (btDevice != null) { GBDevice.Type deviceType = GBDevice.Type.UNKNOWN; - if (btDevice.getName().indexOf("Pebble") == 0) { - deviceType = GBDevice.Type.PEBBLE; - mGBDeviceProtocol = new PebbleProtocol(); - mGBDeviceIoThread = new PebbleIoThread(btDeviceAddress); - } else if (btDevice.getName().equals("MI")) { + if (btDevice.getName() == null || btDevice.getName().equals("MI")) { //FIXME: workaround for Miband not being paired deviceType = GBDevice.Type.MIBAND; mGBDeviceProtocol = new MibandProtocol(); mGBDeviceIoThread = new MibandIoThread(btDeviceAddress); } + else if (btDevice.getName().indexOf("Pebble") == 0) { + deviceType = GBDevice.Type.PEBBLE; + mGBDeviceProtocol = new PebbleProtocol(); + mGBDeviceIoThread = new PebbleIoThread(btDeviceAddress); + } if (mGBDeviceProtocol != null) { mGBDevice = new GBDevice(btDeviceAddress, btDevice.getName(), deviceType); mGBDevice.setState(GBDevice.State.CONNECTING);