Is defining device name in string resources still considered the best way of getting device at runtime in an app?

Previous posts suggest that using different resource folders with a different resource string for each of the devices you support for a watch app was the 'best' way of getting the device name at runtime.  Is this still the recommended way of doing this?

I am having issues with this because I have not found a way to make this work if you also have different resource folders for different languages because you obviously can't define the resource string in these without getting duplicate definitions of the same string id: one for the device and one for the language.  This creates warnings about undefined string resources which I happily ignored until I installed SDK 3.1.x.

At first I had an issue with the SDK  Manager which would not let me select 3.1.4 as the Current SDK on top of 3.1.3.  Removing the 3.1.4 installation and downloading/installing it again seems to have overcome that issue.  However I now cannot run eclipse/simulator in Debug mode.  I can run them in non-Debug mode but when I try in Debug mode I just get a blank window and the 'compiler' issues a warning about an undefined string resource for the first of the additional languages, but not the others that I used to see in 3.0.12 (see above) so I suspect that it is barfing over this issue but only in Debug mode (huh?).  Of course I tried removing 3.1.4 and using 3.1.3, but the Debug problem lingered, so I am back to 3.0.12 where it all works fine.

BTW I am running eclipse Version: 2019-06 (4.12.0) on a Mac with Mojave (10.14.6)

  • There are different ways to ID a device at runtime.

    The most exact is to use Sys.getDeviceSettings().partNumber, as with it, you can see if it's not only a fenix 5, but if it's a ROW or APAC variant.

    Then you can use resource overrides or Jungles.  What you're doing should work, so I suspect there's a bug some place in how you are doing things.

    Then, you can also figure things out yourself.  If the device is round and has a width/height of 280, it's a fenix 6x for example, and for the more common sized (say 240x240) if it matches that and a specific font has  a certain height (dc.getFontHeight()), you can narrow it down.

    It all kind of depends on what you need to do based on the app you are building.