Widget launcher icon, multiple resolutions

I have created a widget for 260x260 watches with a 40x40 launcher icon. 

I would like to add support for 240x240 watches which require 36x36 launcher icons. Do I need to make the launcher icon 36x36 for all watches or can I have both launcher icons and the correct one is used for the correct watch?

  • With 4,0, you don't actually have to change anything.  It will stretch/shrink//trim the launcher_icon as needed for a specific device

    This is something that is not only for CIQ 4 devices, but works on any device.

  • And 4.0 is available in review, meaning it probably won't be longs before it's the production SDK.

  • The XML file that actually refers to the launcher icon also has to be in the "resources-round-218x218" folder.

    i.e. Create a file called "launcher.xml" (or whatever) in resources-round-218x218 with the following contents:

    <drawables>
        <bitmap id="LauncherIcon" filename="launcher_icon.png" />
    </
    drawables>

    Default, device/family-specific or overridden resource paths are only used to load resource XML files. Any paths to other resources (like bitmaps, fonts or JSON) are always resolved relative to the referring XML file.

  • Thanks, this documentation doesn't show that file in the directory structure: https://developer.garmin.com/connect-iq/core-topics/build-configuration/

    So I had left it out. That solved it.

  • No worries. (Alternatively, you could call it drawables.xml to reflect the fact that it contains <drawables> and also in case you end up adding other 218x218-specific drawables to the file. But the name of the file is totally up to you.)

  • I am trying to clean up the warnings from the  4.0.9 SDK and am stuck with this one:

    "The launcher icon (30x25) isn't compatible with the specified launcher icon size of the device 'fenix5' (40x40). Image will be scaled to the target size.",
    	

    I'm currently supporting 65 devices , and with their range of 8 different icon sizes,  I can build appropriately sized icons, but I'm struggling to find a simple way of grouping them in resources.

    I thought I might be able to do it by screen shape, but unfortunately the sizes are not unique to device-family:

    As you can see from the above pivot table, generated from the devices files, for example, the round-240x240 (highlighted) has both 33x40 and 40x40, so they aren't unique.

    I know it's only a warning, and the compiler resizes the icons, but it would be nice to for once have a compile with no  warnings!

  • It's easy to hide the warnings.  In VS Code, it's under the extension settings:

    And in Eclipse, here:

    That way you don't have to worry about them or see them.

  • Sure, that hides the warning, but I can't help feel that is disrespecting our Garmin colleagues, who must have some reason for drawing it to our attention. 

    By hiding all warnings, we may miss something that later turns around to bite us in the backside. 

    I would like to find a way to resolve the warnings, not sweep them under the carpet.

  • 1) Create a resource folder for each unique launcher icon size, and place the launcher icon/xml in it. e.g.

    resources-launcher-30-30/
    resources-launcher-33-40/
    resources-launcher-40-40/

    ...

    2) In monkey.jungle, either handcode or generate the mapping from device to launcher icon. e.g.

    fr945.resourcePath = $(fr945.resourcePath);resources-launcher-40-40

    ...

    I know it's only a warning, and the compiler resizes the icons, but it would be nice to for once have a compile with no  warnings!

    Well I'd say it's a relevant warning (as in not completely meaningless), as the result you get from the compiler resizing the icon may not look as nice as the properly-sized icon that you would provide in order to resolve the warning.

    EDIT: fixed typo in code