Device info; Glance (yes/no) and size. And font size/width in pixel

The device ref has a lot of info, but I'd also like to know which devices uses glances. And if so, what size it is. Maybe the first can be derived from the API level?? And the latter from the display size maybe??  

Also, the device ref shows a number for the various font sizes. That must be the height in px, right?? Is there anywhere to see the width? Or can that be calculated from the height?? 

I have looked these two places:

/connect-iq/reference-guides/devices-reference

/connect-iq/compatible-devices/

Update: Just discovered "Glance" listed under App Type for each device. So that kinda takes care of the glance yes/no. Still ought to be added to the overview list...

But size still not found...   

  • If a device supports grlances, you can check with 

    if(Toybox.Application has :getGlanceView) {
    In your main view, you can see if it was started from a glance with
            var sSettings=System.getDeviceSettings();
            if(sSettings has :isGlanceModeEnabled) {     
            	fromGlance=sSettings.isGlanceModeEnabled;
            }
    On the fr945, the user can turn on/off glances.  With most devices, it's not an option.  There are no glances (the fenix5 for example), or there are always glances (the fr955 for example)
    When it comes to the glance view itself, dc.getWidth() and dc.getHeight() can be used to determine it's size, and for fonts, there are FONT_GLANCE and FONT_GLANCE_NUMBER
    You can use dc.getTextWidthInPixels() so see how wide a given string is.
    Much easier than hard coding the sizes of things, as each time there's a new device, it's something you need to maintain

    Don't forget about the (:glance) annotation, and scoping resources you use in the glance.

    See this thread for more info, including a simple widget with glances.  It's a bit old and doesn't have anything for type checking, so you may want to turn off type checking for the app when trying it.

    https://forums.garmin.com/developer/connect-iq/f/discussion/259993/can-i-write-one-widget-with-glance-view-for-all-watches

    Another thing to consider is if the device supports "Live update" for a glance,  See https://developer.garmin.com/connect-iq/core-topics/glances/#glances

  • Thanks Jim,

    I'm already using the .getHeight/width methods to layout the view and glance. Mainly sim testing with VENU 2 and Fenix 6, as it's the devices me and my betatest friend has.

    Layout with  dc.getHeight * 0.35 etc. workes fine for the main view over multiple devices, but not so much for the glance. The same font seem to vary more on relative size between the 2. So the reason I wanted the list of devices with glance was not so much for runtime use, but more to get a feel for how many different glance sizes one is up against... And to avoid having to run through them all in the sim, but instead target a few select with different size.

    On my VENU2 you can launch the widget both via the glance and also via the activity button. I suspect that's the same for all glance enabled devices. But do I need to care how it was launched??  I mean, it's either one or the other onUpdate that's called, so each just do their thing right?   

  • On my VENU2 you can launch the widget both via the glance and also via the activity button. I suspect that's the same for all glance enabled devices.

    It's only the case for CIQ 4 devices, which support "super apps". These devices don't technically support widgets - any widget that you build for a CIQ 4 device will actually appear in the Connect IQ store app as a device app, when a CIQ 4 device is currently selected. 945 LTE (for example) supports glances, but is not a CIQ 4 device.

    But do I need to care how it was launched??  I mean, it's either one or the other onUpdate that's called, so each just do their thing right?

    Classic widgets (on older devices without glances or with glances disabled) display their (full-screen) initial view as you scroll through the widget loop by pressing UP or DOWN from the watch face.

    If you build a widget for a device which may or may not have glances enabled, then you may wish for the glance view to display the same or similar "summary information" as the initial view with glances disabled. e.g. A steps widget may display the total number of steps for the day for the summary information.

    In each of these cases, when the user presses START on the "top-level summary view", the dev may wish to immediately display more detailed information (e.g. steps per day for the last seven days).

    So the view flow looks different in each case:

    - Widget with glances enabled: glance view (summary) > (user presses START) > initial app view (details)

    - Widget was glances disabled: initial app view (summary) > (user presses START) > 2nd-level app view (details)

    In the each case, the widget has to return something different in getInitialView(), depending on how the widget was launched.

    There's also the consideration, as noted in the isGlanceModeEnabled docs, that the top-level / initial widget view can accept UP/DOWN key events if it was launched from a glance, but not if it was launched with glances disabled. This is also due to the fact that for classic widgets, the initial view is displayed while the user scrolls though the widget loop.

    Of course the situation is a little different for CIQ 4 super apps. For a CIQ 4 app, the glance view basically has to be treated as optional, since the user can always launch your app from the activity/app list. And ofc unlike classic widgets, there's no concept of the initial view ever being displayed as you scroll to the app.

    So your hypothetical CIQ 4 steps app might look a bit different:

    - Launch from glance: glance view (summary) > (user presses START) > initial app view (summary + details)

    - Launch from activity list: initial app view (summary + details)

    In this case I don't see a way to determine whether your app was launched from a glance (although perhaps I'm missing something).

  • When showing a glance, there are often 3 shown at a time on a watch, though things are a bit different on the Instinct 2 devices and may not be as visible, due to the subscreen, and overall size.. And edge devices can be very different.

    When you do something like height*.35 in the main view, that's about 1/3 from the top.  It's the same in a glance view, but the overall height is much different.  On some devices, you can easily place 2 rows of text using FONT_GLANCE_*, on some, 3 rows.   When you talk about getting to the glance/widget loop on the Venu2, you can do about the same on devices like the Fenix6 with a hotkey.

    with FONT_GLANCE_*, those can (and do) vary by device, but are used so CIQ can use the same fonts as the native ones.