I've made a watch face and I want to support it on more devices than just the Fenix 6. Different watches will need different size bitmaps and have slightly different code. How can I have unique assets and unique code for each device?
I've made a watch face and I want to support it on more devices than just the Fenix 6. Different watches will need different size bitmaps and have slightly different code. How can I have unique assets and unique code for each device?
Check out this content for having different resources for different watches:
[https://developer.garmin.com/connect-iq/core-topics/build-configuration/]
As far as having different code based on each device (family), it depends on how you want to structure your code and how much memory you need to save.
One way is to use exclude annotations to have different versions of the same function for different watches:
[https://developer.garmin.com/connect-iq/core-topics/build-configuration/#feelingexcluded] (Scroll to "Feeling Excluded" if you're not taken there automatically)
The downside here is that exclude annotations only work at the symbol level (e.g. function, member variable, etc.), so you may find yourself copying-and-pasting entire functions with just small differences between versions (if you want to save memory), or creating tiny helper functions for that one difference between devices (which is better for code maintenance but uses up precious memory on code).
Another more granular approach would be to call dc.getWidth() and dc.getHeight() at run-time, to determine your screen dimensions, so that you could run different code for 240 x 240 watches vs 260 x 260 watches (for example).
Exclude annotations work fine, but you may find that your jungle file becomes unwieldy if you need to differentiate between all the different quirks and traits of various devices (like differences between CIQ support, differences between available memory, random quirks like the fact that VA3 and 935 have different fonts even though they have the same size screen, etc.)
Thanks for the quick answer. For some reason the first link you posted is bringing me to a 404 page. Do you know of another place I could go to get the same info?
Np.
My bad, I edited the post to fix the link.
for compile time image scaling, as that can help and simplify with bitmaps.
When it comes to a few things, "has" can be really handy