1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-28 21:06:50 +01:00

Call getDevice always when connected

This fixes a longstanding bug where device attributes where ONLY updated when fetching activity data or when pairing a new device
This commit is contained in:
Andreas Shimokawa 2016-11-27 10:32:56 +01:00
parent 24752d3455
commit 723ad53588

View File

@ -169,12 +169,13 @@ public class DeviceCommunicationService extends Service implements SharedPrefere
boolean enableReceivers = mDeviceSupport != null && (mDeviceSupport.useAutoConnect() || mGBDevice.isInitialized());
setReceiversEnableState(enableReceivers);
GB.updateNotification(mGBDevice.getName() + " " + mGBDevice.getStateString(), mGBDevice.isInitialized(), context);
if (device.isInitialized() && (device.getType() != DeviceType.VIBRATISSIMO)) {
if (device.isInitialized()) {
try (DBHandler dbHandler = GBApplication.acquireDB()) {
DaoSession session = dbHandler.getDaoSession();
if (DBHelper.findDevice(device, session) == null) {
DBHelper dbHelper = new DBHelper(context);
DBHelper.getDevice(device, session); // implicitly creates it :P
if (DBHelper.findDevice(device, session) == null && (device.getType() != DeviceType.VIBRATISSIMO)) {
if (dbHelper.getOldActivityDatabaseHandler() != null) {
Intent startIntent = new Intent(context, OnboardingActivity.class);
startIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
@ -182,7 +183,7 @@ public class DeviceCommunicationService extends Service implements SharedPrefere
startActivity(startIntent);
}
}
} catch (Exception _ignore) {
} catch (Exception ignore) {
}
}
} else {