RUN/STOP State Issue

This is a strange one....

I keep a counter for Stop Time, by incrementing a counter every compute() cycle (every 1 second) whenever the state of the device is STOPPED, PAUSED *or* if speed=0. That way I can track my moving -vs- stop time even if auto-pause is off... Keep my own view of stop time since with auto-pause off, the built-in timers don't keep track of it.

Anyway. So I stop an activity and *discard* it. Then I start a new activity. But my internal counter is not reset. I have to power off and power back on my device. This is a Garmin Edge 520.

I don't know of a STATE or condition that informs that an activity was discarded so I can zero out my counter.

Not a big deal. But would be nice to handle that corner case if there is a way to detect a discard event.
  • It seems that you can probably look for Activity.TIMER_STATE_OFF, but it seems like it would be better to use the onTimer...() callbacks defined in Ui.DataField. The one that would be most useful for what you are trying to do is onTimerReset().

    Using the timer callbacks has one big advantage... they are invoked when the event occurs so you can do something immediately instead of waiting until the next update which could be as much as one second after the event. You can use this to your advantage to improve the quality of your data.

    Travis