Newbie developer questions

First I'll introduce myself, I'm Bennie, 54 years old and suffer ME for 15 years now.

I bought a Venu3 almost a year ago to monitor my health and see if it could help me manage my energy, and I'm lucky, cause it does. As the representation of data valuable to me is in different places I designed a watchface to have it shown to me in colors instead of numbers to make it more intuitive.

I have a background in programming from Cobol to C++ however I haven't been coding for over 15 years. One of the benefits of using my Venu3 is that I can code again. Suggestions for recent good code examples would be welcome, as a lot of information I can find is almost as rusty as I am.

Questions I have with regard with my current developments:

1. Settings. Is it because I have a Venu3 I cannot use settings directly from the watchface? Is the only possibility to create settings that are managed from the store app? I'd like to give users the option for two switches, One to choose between showing month number or week number, and the other option to show or hide the background picture. I like to keep things simple, but this would add value for the users.

2. Energy management. In old documentation there is a lot about saving energy before onPartialUpdate was introduced and with regard to current documentation I only use onUpdate. Is it helpfull to store the background drawn over partially to have it partially restored the next second, or is this something done by the system itself nowadays?

3. Is it possible to dynamic code drawables from the XML file? As I understood the ids are hardcoded by the compiler. I want to use my own watchface framework and derive several thematised watchfaces from it. I'd like the code to cycle through the avaible drawables from the XML file and choose the one to use dynamicly. Is that possible? For now I use a black 2x2 pixels .png as a workaround.

4. When I use the bodybattery from complications every calculation with it returns 0, I have made a workaround passing it through a string and back to a number to fix this. Maybe I'm using complications wrong? The other complications I use in exact the same way don't have this problem. It feels like a pointer is passed instead of a value.

That's it for now, as I'm getting used to the environment I'll hope I'll have less questions to ask and more answers to give.

Thanks in advance for helping me out.

Top Replies

  • 1. Settings. Is it because I have a Venu3 I cannot use settings directly from the watchface?

    All devices with CIQ API level >= 3.2.0 support on-device settings, which is all devices released…

All Replies

  • I guess my posts are moderated because I'm new, but as the post datetimemark was not it misfired the active topics. So I hope it's oke I kick it.

  • It also says now all replies are moderated? I hope this is in error..

  • 3. possible. You need to create an array constant that includes all the Rez.Drawables.icon1, Rez.Drawables.icon2, ... and then load them on demand with loadResource.

    4. You don't need complications for body battery. Use: SensorHistory.getBodyBatteryHistory

  • Thanks for replying. I actually do like to event based push principle of the complications system. Using SensorHistory would also add an extra question for rights to the user. I guess it will be fixed in the future, but for now it works.

  • 1. Settings. Is it because I have a Venu3 I cannot use settings directly from the watchface?

    All devices with CIQ API level >= 3.2.0 support on-device settings, which is all devices released in roughly the past 6 years, including Venu 3. Venu 3 is a device that's currently supported with firmware updates, and it has CIQ 5.1.0.

    https://developer.garmin.com/connect-iq/core-topics/properties-and-app-settings/

    On Device Watch Face and Data Field Settings

    Since API level 3.2.0

    Device applications, widgets, and audio content providers all accept user input that allow them to implement on-device settings in the app. Watch faces and data fields are not allowed to accept input or push views that would allow on device configuration.

    If you want to provide an on-device settings user interface for your watch face or data field, you can implement AppBase.getSettingsView(). getSettingsView() functions similarly to AppBase.getInitialView() where you return a WatchUi.View and WatchUi.InputDelegate pair that can serve as the initial view.

    Watch face configuration is available to the user in the system Watch Face menu. Data field configuration is available from the activity menu.


    Is it helpfull to store the background drawn over partially to have it partially restored the next second, or is this something done by the system itself nowadays?

    Depending on how complex your rendering code is, it might be helpful to render to a BufferedBitmap so you only have to re-render the parts that change. The system will not do this for you.

    Couple of potential issues though:

    - buffered bitmaps will use the shared graphics pool which is nice because it doesn't use your app's memory, but is not so nice because it counts against the graphic pool memory shared by all apps

    - https://developer.garmin.com/connect-iq/core-topics/graphics/

    Buffered Bitmaps and the Graphics Pool

    BufferedBitmap objects, like other graphics resources, now take advantage of the graphics pool, as well. The advantage of this scenario is that you can now liberally use temporary graphics buffers without running out of application heap.

    As noted earlier, the graphics pool will intelligently purge and restore resources from the pool if the loaded resources exceed the available pool space. Unlike static resources that are reloaded from your executable, BufferedBitmap are not restored if they have been purged. This works fine if you are using a short-lived, temporary buffer, but if your bitmap is purged after allocation, you need to re-render its contents. Alternatively, you can call the get() method on the reference to get a locked version of the bitmap. This will prevent the BufferedBitmap object from being purged from the pool, but it can also lead to the graphics pool running out of available space if more resources are loaded.


    In old documentation there is a lot about saving energy before onPartialUpdate was introduced and with regard to current documentation I only use onUpdate

    AMOLED devices update once per minute in "low-power mode" (when user isn't looking at their watch) and once per-second in "high-power mode" (which is active for a few seconds after the user turns their wrist to look at the watch.

    MIP devices are similar, except if you implement onPartialUpdate, you can also update your watchface once per second in low-power mode.

    So onPartialUpdate() isn't intended to save energy per se, it's intended to allow you to update your watchface at 1 Hz all the time. (Ofc it's also designed to do so in a way that doesn't use too much energy. The point is that using onPartialUpdate() doesn't save any energy compared to not using onPartialUpdate(). If anything, using it would consume more energy than not using it, but not obviously not to an extent that's unacceptable to Garmin.)

    There's a good explanation of this stuff here:

    [https://developer.garmin.com/connect-iq/user-experience-guidelines/watch-faces/]

  • Thanks for your reply, this helps me a lot.