Can I write one widget with glance view for all watches

I plan to write simple widget, icon, progress (line) text - so it' can be maybe ciq 1.x app

If I implement getGlanceView(), will this widget run for all watches? If no glance system shows view?

By the way is any place to see what functionality are implemented on each watch? My widget will show stress but on my f6 there is widget with stress and if this widget is on all watches I don't want to spend time unproductive.

  • So what does it exactly mean:

    Devices that have less memory [2] will start the app only when the system deems it appropriate, and calls to WatchUi.requestUpdate()
    will have no effect. <------ NO EFFECT NO onUpdate????
    Such a device could update the ‘Glance Page’ when it becomes visible (activated) and
    at least 30 seconds since last update. <-------
    - WILL SYSTEM CALL onUpdate evry 30 sec?
    - can I call requestUpdate every sec but onUpdate  will call only evrey 30s?
    - I can't
    call requestUpdate every sec  and have to cal it every 35s?

    It means that calling WatchUi.requestUpdate() won't do anything. If you read further in the docs, it explains that the whole app life-cycle (onStart(), onShow(), onUpdate(), onHide() onStop()) will happen every 30 seconds.

    So yeah, it's like the system calls onUpdate() every 30s. But it's more than that -- it's like the app (the glance version of the app) is launched every 30s, does one update, and stops immediately.

    developer.garmin.com/.../

    Background UI Update

    Devices that have less memory [2] will start the app only when the system deems it appropriate, and calls to WatchUi.requestUpdate() will have no effect. Such a device could update the ‘Glance Page’ when it becomes visible (activated) and at least 30 seconds since last update.

    During a background update, the Widget and its GlanceView will run through a complete life cycle. The AppBase functions onStart(), getGlanceView() will be called to start the app and retrieve the view. Once the GlanceView has been retrieved, the View functions onLayout(), onShow(), onUpdate() and onHide() will be called. The AppBase function onStop() will be called, and the app will be shut down.

    All content that is rendered to the dc passed to View.onUpdate() will be cached on the filesystem and used to display until the next time the system decides to do an update.

  • Speaking of different versions of the widget (full mode and glance mode), you'll see that there's different memory limits for glance and for widget. e.g. fenix6:

        "appTypes": [
            {
                "memoryLimit": 32768,
                "type": "background"
            },
            {
                "memoryLimit": 32768,
                "type": "datafield"
            },
            {
                "memoryLimit": 32768,
                "type": "glance"
            },
            {
                "memoryLimit": 131072,
                "type": "watchApp"
            },
            {
                "memoryLimit": 114688,
                "type": "watchFace"
            },
            {
                "memoryLimit": 65536,
                "type": "widget"
            }
        ],

    (Similar to a background process vs foreground process)

  • after test, it is bad Disappointed

    it's impossible to force update, user has to press button and if it happen 30s after last update system call onUpdate... I don't understand such limitation and troubles for dev

  • and now I have to:

    - check memorry if it's less than 29kB - no redraw - write stupid text go to full view?

    - is it possible to show in this example at once full view?

  • how to recognise on 100% what kind of device the widget run?

    f245 and f245m, shows 28kb both

  • - check memorry if it's less than 29kB - no redraw - write stupid text go to full view?

    You could do what I do and not provide a glance view at all, when live updates are not possible. Then glance mode will only show launcher icon + app name. That might be better or worse depending on what kind of app it is. I wouldn't check if memory is less than 29KB, I would hardcode the devices which support live updates in the jungle file and use exclusions.

    - is it possible to show in this example at once full view?

    Only if the user disables glance mode in their device settings. (This can be done in the sim, too. Settings > Glance View)

  • how to recognise on 100% what kind of device the widget run?

    f245 and f245m, shows 28kb both

    Don't look at memory, use hardcoded exclusions in the jungle file.

    e.g.

    fr245.excludeAnnotations = glance_live_updates

    fr245m.excludeAnnotations = no_glance_live_updates

    Then you can use those annotations to provide different functionality in your app.

    Alternatively:
    - Your first onUpdate() could display the "non-live" view

    - All subsequent onUpdate() calls could display live data.

    That would avoid hardcoding "liveUpdate" capabilities in the jungle file, but it might not look great.

  • How to do it? I have never used annotation in code? Can you give me an example?

    And because only few have live update I'd like specify only for this ones not for all.

  • The code I posted in the beginning uses the annotation for the glance view.

    Neat the top of GlanceSampleView.mc:

    (:glance)
    class MyGlanceView extends WatchUi.GlanceView
    {

  • no, the code for jungle annotation