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?

  • Interesting, thanks! I didn't realize that widget type apps would be automatically converted to super apps when you build them for CIQ 4 devices. That's helpful to know.

  • I wonder what that means for existing widget type apps in the CIQ store? Can support be added for CIQ 4 devices, or do they have to be redeployed as device apps?

    For example, I have two stopwatch apps in the store: one is a device app and one is a widget.

    If I add support to both of them for CIQ 4 devices, and I add a glance view to the device app, do they both become super apps which appear in the activity list and the glance list? Or will the widget never be available for CIQ 4 devices?

  • I have the same app built as app and widget. But don't have 4.0 watch to test Slight smile

  • But don't have 4.0 watch to test

    Neither do I. I have a 3.x watch (945 LTE) which has the same / similar UI as CIQ 4 devices (on beta firmware).

  • Yes, on a CIQ 4 device, you actually no longer have an app type of "widget".  If you take a watch/device app and add a glance view, it will show in the glance loop on a CIQ 4 device.

    "super app" really only means a device app with a glance view.

  • Yes, on a CIQ 4 device, you actually no longer have an app type of "widget".  If you take a watch/device app and add a glance view, it will show in the glance loop on a CIQ 4 device.

    "super app" really only means a device app with a glance view.

    Yes I understand all of that. That's literally what I wrote in my explanation of super apps above.

    I'm asking in the context of what you said about how building a widget for a CIQ 4 devices transforms it into a device app.

    What is the implication for *existing widgets already uploaded to CIQ store*? Can you add support for CIQ 4 devices, or do you need to redeploy it as a new device app with a different UUID and a "device app" type?

  • But CIQ wise, CIQ 4 devices are very different.  Super apps for one thing.

    If you don't have a CIQ 4 device (not to be confused with "System 5" as that includes CIQ 3.3.x) you may want to think about getting one if you plan to support CIQ 4 devices with your apps.

  • Again as a specific example, I have the same stopwatch codebase deployed as two separate apps on the store:

    - Stopwatch device app

    - Stopwatch widget

    I haven't added CIQ 4 support yet.

    So before you said all of that about how a widget can be converted to a device app for CIQ 4 devices, I would've just added a glance view to the "stopwatch device app" and called it a day.

    But now I wondering whether support for CIQ 4 devices can also be added to the *existing* stopwatch widget. Previously my understanding would've been "no". But now I'm not sure.

  • If you don't have a CIQ 4 device (not to be confused with "System 5" as that includes CIQ 3.3.x)

    I know what System 5 is, since I bring up the issue with CIQ 3.3 and CIQ 4.1 every time it's mentioned.

    CIQ 4 devices are very different.  Super apps for one thing.

    Thanks, I realize that since that's literally what we're talking about in this thread.

    you may want to think about getting one if you plan to support CIQ 4 devices with your apps.

    Honestly, I hate the idea is that every time a dev needs to understand the idiosyncrasies of new hardware or CIQ versions, the suggestion is to go out and buy that hardware. Not everyone has the money or inclination to do so.

    I appreciate the advice tho.

  • You mean adding a glance view to your device app and having it work on CIQ 3 devices?  Try it, but I would expect it would work just fine.  Like having a glance view in something and running it on a device that doesn't support glances.