Widgets for Fenix 6

Thanks Garmin for the SDK update, 3.1.3 allows to get watchface and data fields easily for the new watches, but doing the same job for widgets means some work...

Recompiling an "old" (fr935/fenix5) widget for the fenix6 shows only a small icon and the name of the widget which can be scrolled up and down using the keys but that's it. Does anyone have a small example source code for the new widget type?

  • Since you're not starting GPS, the best you can expect from getInfo() is a location with "LAST KNOWN" accuracy and that will go stale after a while.  You can also get the same from Activity.Info.

  • Yes, I wondered about that. In testing you get the quality you've set in the simulator not what's in the FIT file (I don't know if FIT files contain quality/accuracy info anyway?)

    But it's still inconsistent that one Positioning call returns an error and another doesn't.

  • But it's still inconsistent that one Positioning call returns an error and another doesn't.

    Yes, it feels as though Position is standing for two things here - the privacy question of allowing the widget access to your location at all, and the performance question of activating the GPS.

    That said, thank you for the information - it's perhaps something I can work with. I'm minded to keep my Glance as lightweight as possible (so no web requests, even with a background service), but I see a way to improve behaviour on non-Glance devices where currently GPS is activated if you scroll through that widget, which slows things down, while still giving the user some potentially useful values.

  • Thanks Jim! This is a really great thread and I’ve learned a thing or two here as well!

  • I published my first widget with a glance view and decided to start with a really simple one.  In full screen, it's under 20kb, doesn't use a background process (as my weather widgets do) and has two simple things to display - the temperature from the watch's temperature sensor and that from a paired Tempe sensor.

    https://apps.garmin.com/en-US/apps/17580ca9-816e-4203-a6a5-002eb543c04a

    But there is a bit of trickery due to the Tempe.  It can take a minute to connect, so it's data won't be available right away.  On a higher memory device, it will update when connected, but on the lower memory devices, it won't. 

    In the basic widget, I'd cache the tempe data, so there would be data for the tempe available while attempting a new connection (with app settings to define the time before it went "stale").

    And I'm making use of that here.  When either the glance view or the full screen view gets Tempe data, I save it in the ObjStore/Storage, and in either, when starting up, grab that data to display initially.

    This is an example of where using the ObjStore/Storage can come in really handy to pass data between the glance view and the full screen view.

    The other thing to note, is I bet many widgets use the default launcher_icon, but when in a glance, it's much more visible! (I never claimed to be good at drawing icons!  Slight smile)

  • Was any of you able to use bitmaps on Glance view? Of course with scope setting... As I see above - it seems to not to work, or we do something incorrectly?

  • Haven't tried, but I believe that with so little memory available (28kB) you wouldn't be able to do much if you could load it.

  • hi,

    hum the "scope" method does not seem to work for me, or I did a mistake?!

    in my Fonts.xml I put:

    <font antialias="true" id="icons" scope="glance" filename="Icons.fnt"/>

    and in Glance initialize : 

    icon = Ui.loadResource(Rez.Fonts.icons);

    it works great on SIM but here is the error I get on real device: 

    Illegal Access (out Of Bounds)

    what does it mean please. PS i'm running at 20.8 memory peak on glance view

  • it works great on SIM but here is the error I get on real device: 

    Illegal Access (out Of Bounds)

    It sounds like the device you're running on doesn't have the support for ConnectIQ 3.1.3.