You should be able to save your data App.onStop(state) and read them back in App.onStart(state).
function onTimerPause() {
_pauseCount += 1;
}
function onTimerReset() {
_pauseCount…
However, in the context of the onStart event I don't believe I have access to the activity's info properties - or do I?
The difference between the two is that they both start at 0 when you start an activity. Elapsed time continues to run until the activity is saved or discarded.
However, timerTime will stop when you pause…
...would it be valid to test for timerTime < elapsedTime as an indicator of a continued activity?
Is there some reason that you can't you call Activity.getInfo()? Also, average speed can be zero if GPS is off, so this isn't a reliable way to detect an activity reset.
Many activities make little sense without speed. I suppose you could use elapsed time.
I don't know what the state of Activity.getInfo() would be in onStart, do you?
The difference between the two is that they both start at 0 when you start an activity. Elapsed time continues to run until the activity is saved or discarded.
However, timerTime will stop when you pause an activity, so you see the recorded time. This means if you paused even for a few seconds (you can manually pause many apps, and some also have auto-pause) and then resumed, timerTime will be less than elapsedTime for the rest of the recording
If you save off timerTime, you can check if it's less than it was the last time, meaning a new activity has begun. If it's the same, recording has been paused, and if it's increasing, you are recording.
I'm just talking a standard recording here and not a "resume later" type function,and for that it will probably be more complex.
What about instances of global class variables? Do they also get out of scope when an activity is stopped and "resumed later"?
You mean static variables? Just like anything else in your CIQ data field app's memory, they're lost when the user selects "resume later", because the CIQ data field app is terminated and the watch doesn't automatically save its state anywhere.
When an activity is "suspended", the only state that's automatically saved is the native activity state.