Temporal Event Delete Hygiene?

I see most suggest reaping your BG Temporal Event "deleteTemporalEvent()" in the onTimerStop() method.

I don't understand why. Athletes often tap the STOP button mid-activity as a manual "pause" if they don't use auto-pause, and then START again. Many times during an activity. At least on the Garmin EDGE cycling devices. Terminating the BG isn't desirable here. Or, you'd have to re-register it on onTimerStart() every time.

It seems to me the onTimerReset() or the main app's onStop() (if you use a variable to only run the reaper in the FG) are much better places to reap the BG to keep it from becoming a zombie process. Those are called once the Activity is actually finished (SAVED or DISCARDED - onTimerReset) or when the Device is Powered Off (onStop).

Am I missing something in my understanding?

Thanks!

  • The question is if the user pauses the activity for more than 5 minutes, and then resumes, then would you want to trigger a temporal event immediately? If the answer is no, then probably it doesn't matter. If the answer is yes, then you should delete the temporal event as soon as possible, in the hope that when you'll re-register it then it can be triggered sooner (or immediately if 5 minutes passed)