There are some internal variables I maintain in my data fields that are lost in the rare instance when my Garmin resets mid activity. Or when I use the Edge Feature where you can stop an activity, hold the power button, and POWER OFF the device... then power it back up and continue the Activity where you left off. That last use case seems like a bug.... Garmin should save the memory state, but they don't.
Anyway, this is the best way I've found to code a reliable "Crash Recovery" to restore those interval variables so your CIQ application's state is maintained across crashes and Power Off / Restart cycles.
Garmin does restore many native metrics across a crash, like distance, total ascent, etc. But they don't maintain YOUR variables (of course).
For example, say you are maintaining something simple like the Lap Count (increments every time the lap button is pressed). And you'd like that counter to be accurate after a crash. This seems to be the best way to handle this... Your app's lap counter will restart at 0, even if, say, you were on lap #6. So, when your app's counter says 3, you are really at 9. And to handle a 2nd crash, you need to continue to save the current working value (eg: 9). So to generate the accurate working value, you need to add the Crash Recovery Value to the "change" in the current value.
