Merge pull request #144 from sarg/master

Initial support for newer MI devices.
here
Carsten Pfeiffer 2015-10-18 09:57:13 +02:00
commit 1073303849
2 changed files with 3 additions and 1 deletions

View File

@ -183,6 +183,8 @@ public class DeviceCommunicationService extends Service {
} else {
deviceSupport.connect();
}
} else {
GB.toast(this, getString(R.string.cannot_connect, "Can't create device support"), Toast.LENGTH_SHORT, GB.ERROR);
}
} catch (Exception e) {
GB.toast(this, getString(R.string.cannot_connect, e.getMessage()), Toast.LENGTH_SHORT, GB.ERROR);

View File

@ -79,7 +79,7 @@ public class DeviceSupportFactory {
try {
BluetoothDevice btDevice = mBtAdapter.getRemoteDevice(deviceAddress);
if (btDevice.getName() == null || btDevice.getName().equals("MI")) { //FIXME: workaround for Miband not being paired
if (btDevice.getName() == null || btDevice.getName().startsWith("MI")) { //FIXME: workaround for Miband not being paired
gbDevice = new GBDevice(deviceAddress, "MI", DeviceType.MIBAND);
deviceSupport = new ServiceDeviceSupport(new MiBandSupport(), EnumSet.of(ServiceDeviceSupport.Flags.THROTTLING, ServiceDeviceSupport.Flags.BUSY_CHECKING));
} else if (btDevice.getName().indexOf("Pebble") == 0) {