Handle empty RileyLink name correctly
This commit is contained in:
parent
051e811571
commit
851320e6bd
1 changed files with 9 additions and 3 deletions
|
@ -396,10 +396,16 @@ public class RileyLinkBLE {
|
||||||
}
|
}
|
||||||
|
|
||||||
rileyLinkServiceData.rileyLinkAddress = bluetoothConnectionGatt.getDevice().getAddress();
|
rileyLinkServiceData.rileyLinkAddress = bluetoothConnectionGatt.getDevice().getAddress();
|
||||||
rileyLinkServiceData.rileyLinkName = bluetoothConnectionGatt.getDevice().getName();
|
|
||||||
|
|
||||||
// Update stored name upon connecting (also for backwards compatibility for device where a name was not yet stored)
|
String deviceName = bluetoothConnectionGatt.getDevice().getName();
|
||||||
sp.putString(RileyLinkConst.Prefs.RileyLinkName, rileyLinkServiceData.rileyLinkName);
|
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, rileyLinkServiceData.rileyLinkName);
|
||||||
|
rileyLinkServiceData.rileyLinkName = deviceName;
|
||||||
|
} else {
|
||||||
|
sp.remove(RileyLinkConst.Prefs.RileyLinkName);
|
||||||
|
rileyLinkServiceData.rileyLinkName = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue