How do I know if onStop,onStart is suspend/resume or start/stop in my datafield?

In my DF i need to be able to differentiate between starting "from scratch" (then the DF needs to connect to the nearest ANT HR device using ANT ID: 0) and when I am "saving for later" and then "resuming" the activity (then the DF needs to connect to the same ANT ID it was connected before resuming, so instead of 0 I need to use the actual ANT ID).

I thought that in both onStop and onStart I will know if the scenario is "full start / full stop" by having state as null, and the "suspend / resume" by having something else in state. But unfortunately it seems I haven't understand the documentation because in both cases state is null.

Now my problem is that because I can't differentiate between the two onStop-s, currently even if I finished the activity I save the ANT ID, which causes the next onStart (even if it's a totally new activity) load the ANT ID, and instead of connecting the nearest ANT device it only wants to connect to the same device I used last time.

Is there a way (or trick) to differentiate?

  • Scott -You planning to watch the GDVC on the 12th? I'm expecting some new stuff coming!

  • I am.  I am interested to see what system 6 brings.  I also expect that they will finally unveil the store enhancements they teased last year.

  • In the online API doc I've seen some references to System 6, and the breakout sessions seem to indicate something with what apple calls "complications" in watch faces.  I'm also wondering about glance folders.

  • Glance folders were added to the F7 in the last major FW release.  It is just a way to group glances into sub groups.  Seems to be done in the FW and not something directly accessible to CIQ.  So a user could put all their CIQ glances into a single folder.  I played with it briefly but did not get a lot of wow factor out of it as I don't have that many glances on my watch.

  • Glance folders were added to the F7 in the last major FW release.  It is just a way to group glances into sub groups. 

    I think this made users happy who missed the native "My Day" widget (which was just an aggregate of Steps, Floors, Intensity Minutes, and Calories) I'm pretty sure Garmin removed My Day from newer watches because they figured it didn't make sense since its components are duplicated in individual glances, and you can see 3 glances at the same time. (So you could *almost* recreate the same experience by just arranging Steps, Floors, etc. next to each other.)

    So with the addition of glance folders, I think people were able to recreate My Day by putting the individual glances in the same folder. (I'm not sure, but I think information from each glance may have been summarized on the folder itself -- before it's opened -- which is the main thing that ppl seemed to have missed.)

  • That may be one aspect of it.  I did miss the "My Day" widget when I first got my F7.  I don't think the reason it was removed is because it duplicated individual glances, several of the newer glances such as "Training Readiness" and the updated "Training Status" duplicate other glances.  It was probably something to do with the change from widgets to glances that initially made the "My Day" more difficult.  But based on the newer glances, I suspect it could be possible for them to bring it back, they just never have.

    The folder does show a summary of the first two glances in the folder, so you can sort of recreate the "My Day" experience.

  • It was probably something to do with the change from widgets to glances that initially made the "My Day" more difficult. 

    That was the speculation on Reddit (*) but I doubt that's the reason, especially considering the CIQ My Day Advanced widget does the exact same thing (and more), and it also works on newer devices as a glance.

    (*) Something to do with speculation that My Day was originally able to open the individual component widgets, which was thought to be impossible with glances.

    1) I don't think it ever opened the individual component widgets (and how would you be able to distinguish that from My Day simply re-implementing the same functionality as the individual widgets)?

    2) Again, My Day Advanced in CIQ kinda disproves all of that stuff

    3) If individual glances can display information X, Y and Z (e.g. steps, floors, calories and intensity minutes), I'm not sure why a single glance wouldn't be able to display all of the same information. (See point 2)

    Just my 2 cents. I guess we will never know for sure, but again, people did say that glance folders allowed them to recreate My Day so they're kinda happy.

    They can also get My Day Advanced, which shows all 4 metrics as circular charts in the glance (with no text/icons and no numbers.) Not quite the same thing as the original full screen versions of the native My Day and the CIQ My Day Advanced, which had icons and numbers.

    TL;DR I don't see what native widgets can do which native glances can't, except show a full-screen page without the user having to press START or tap on a glance to enter the "full view".

  • I don't think the reason it was removed is because it duplicated individual glances, several of the newer glances such as "Training Readiness" and the updated "Training Status" duplicate other glances. 

    That's a good point, but maybe Garmin just changed their philosophy on that stuff? Idk.

    Training Readiness and Training Status also provide additional/different information above and beyond their "constituent' glances. Like the VO2 Max portion of Training Status isn't the same as the VO2 Max glance itself (including the stuff in the full view of the glance). It's also neither a subset nor a superset of the information in the VO2 Max glance.

    I just don't see what technical barrier there could be to implementing a My Day glance, especially since it was already done in CIQ. It's not like native Garmin stuff is famous for being unable to do things that CIQ code can (quite the opposite.)

    I still feel like Garmin felt My Day was redundant with the introduction of glances, but again, we'll never know.

  • The folder does show a summary of the first two glances in the folder, so you can sort of recreate the "My Day" experience.

    I wonder how that works with CIQ glances, since I assume that a CIQ glance doesn't have a way to know that its glance view is being summarized. Does it just show the icon and name of CIQ glances?

  • The solution I ended up with was to add this function to my app:

        hidden function isInActivity() as Boolean {
            var info = Activity.getActivityInfo();
            return info != null && (info as Activity.Info).startTime != null;
        }
    

    I call it from both onStop and onStart and save/resume the state according to what this returns