Handle empty RileyLink name correctly
This commit is contained in:
parent
051e811571
commit
f5dbf7d7c9
1 changed files with 9 additions and 4 deletions
|
@ -395,11 +395,16 @@ public class RileyLinkBLE {
|
||||||
aapsLogger.debug(LTag.PUMPBTCOMM, "Gatt Connected.");
|
aapsLogger.debug(LTag.PUMPBTCOMM, "Gatt Connected.");
|
||||||
}
|
}
|
||||||
|
|
||||||
rileyLinkServiceData.rileyLinkAddress = bluetoothConnectionGatt.getDevice().getAddress();
|
String deviceName = bluetoothConnectionGatt.getDevice().getName();
|
||||||
rileyLinkServiceData.rileyLinkName = bluetoothConnectionGatt.getDevice().getName();
|
if (StringUtils.isNotEmpty(deviceName)) {
|
||||||
|
// Update stored name upon connecting (also for backwards compatibility for device where a name was not yet stored)
|
||||||
|
sp.putString(RileyLinkConst.Prefs.RileyLinkName, deviceName);
|
||||||
|
} else {
|
||||||
|
sp.remove(RileyLinkConst.Prefs.RileyLinkName);
|
||||||
|
}
|
||||||
|
|
||||||
// Update stored name upon connecting (also for backwards compatibility for device where a name was not yet stored)
|
rileyLinkServiceData.rileyLinkName = deviceName;
|
||||||
sp.putString(RileyLinkConst.Prefs.RileyLinkName, rileyLinkServiceData.rileyLinkName);
|
rileyLinkServiceData.rileyLinkAddress = bluetoothConnectionGatt.getDevice().getAddress();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue