Added update to telemetry on completion of an activity

This commit is contained in:
Philip Abbey
2024-07-20 17:28:57 +01:00
parent c18736e40d
commit 98af5578f0
2 changed files with 103 additions and 82 deletions

View File

@ -95,9 +95,11 @@ class Settings {
if ((Background.getTemporalEventRegisteredTime() == null) or
(Background.getTemporalEventRegisteredTime() != (mBatteryRefreshRate * 60))) {
Background.registerForTemporalEvent(new Time.Duration(mBatteryRefreshRate * 60)); // Convert to seconds
Background.registerForActivityCompletedEvent();
}
} else if (Background.getTemporalEventRegisteredTime() != null) {
Background.deleteTemporalEvent();
Background.deleteActivityCompletedEvent();
}
} else {
// Explicitly disable the background event which persists when the application closes.
@ -182,6 +184,7 @@ class Settings {
Properties.setValue("enable_battery_level", mIsSensorsLevelEnabled);
if (mHasService and (Background.getTemporalEventRegisteredTime() != null)) {
Background.deleteTemporalEvent();
Background.deleteActivityCompletedEvent();
}
}