GET/SET PROPERTIES - and Garmin Device Crashes

Say I'm 20 hours into a 24 hour cycling race. And my damn Edge 820 crashes and restarts. Not that this has ever happened. Twice. :-(

I either have to hold the power button down for like 20 seconds to get it to reset/restart. Or it just reboots on its own.

I have logic in my CIQ data field to save critical metrics every second in a function called from the compute() loop. And I retrieve my stored metrics every second to compare to the Activity. Info() values. If my stored values (eg: elapsed distance) are larger than the device's internal values, I use my stored values. If I discard or save an activity, it clears out the stored values.

This actually works well, and my ride data preserved after a device crash and my metrics continue as if it didn't crash. Love it.

But storing 8 values and retrieving them, and comparing them.... every second... is contributing to higher battery drain and less responsive maps.

Has anyone figured out if instead of doing this every cycle, if the various crash/restart scenarios always invoke an interrupt like an onStart()? It seems to me there are some cases in which it doesn't, so I needed to do this check every cycle.

Thanks - I know this is a little obscure, but it you've looked into this, thanks!


  • Just my two cents, but maybe only save things every minute? Or even five minutes?

    1) if your activity lasts 24 hours or even two hours, you’re unlikely to miss five minutes worth of data, especially if it’s just a bunch of averages and elapsed distance/time.
    2) while the device is rebooting, you lose data anyway, so why not lose a bit more?

    If the device restarts, I thought all CIQ apps were restarted, even with the “resume” feature (or wake from sleep, or whatever it’s called on Edge). Wouldn’t all your app state be reinitialized? Can’t you just do the read check in your apps init routine? Or am I missing something. (I don’t have an Edge). An Edge user of one of my apps reported to me that the state was reset when his Edge woke up from sleep, so I assume apps start from scratch. Same as if you do “resume later” on a newer watch.

    On the contrary, if your app state was somehow preserved, then you wouldn’t need to read the saved data anyway....

    So even if onStart somehow doesn’t get called when your app restarts, you could always have some Boolean var called isInitialized which you set to true when your app starts cleanly. If this var is false, then you do your check.
  • Thanks FlowState - I'll do some experimenting with that idea of a boolean. Great idea!

  • Got the crash recovery logic working. Turns out Get/Set Properties is old news.... Those stored values disappear during a crash. getValues and setValues actually flushes to static memory during the activity.