Is it possible to know the device type?

Hello everybody,I would like to know if it's possible to know the type of device at app runtime, ie to have a string or number representing if the app is running on a Fenix or Vivoactive for example.
Thank you in advance.
  • For things other that DF's you can make a reasonable guess by looking at the width and height of the DC.
    With this and maybe Sys.getDeviceStats().screenShape you won't know the specific device, but you may know enough (if it's a semi-round, do you need to know if it's a 230,235,630, or 735? )



    You can also do things with a string in resource over-rides. For example,
    in resources-fenix3 have <string id="Dtype">Fenix3</string>
    and
    in resources-vivoactive_hr have <string id="Dtype">vahr</string>

    and then in the code, look at Dtype to see what you are running on..
  • var dev, verPartNumber, verModel;

    dev = Sys.getDeviceSettings();
    verPartNumber = dev.partNumber;
    else if ( verPartNumber.equals("006-B2156-00") ) {
    verModel = "Forerunner® 630";
    }
    else if ( verPartNumber.equals("006-B2431-00") ) {
    verModel = "Forerunner® 235";
    }
    ...

    and so on. Partnumbers described in SDK\connectiq-sdk-win-2.2.1\bin\devices.xml
  • Thank I will try both solutions.
    Best Regards.
  • One thing to note about using the part number, is there can be multiple per "device". For example, there looks to be 4-5 just for the 235. (so maybe 16-20, just for the "semi-rounds")

    APAC and non-APAC versions are different part numbers. Depending on how many devices you want to support, maintaining a growing list of PN's could be a hassle.

    (in the store, for many things you'll see "235" and "235J" - The "J" indicates the APAC variants.)

    Using the resource over-ride, or just screenShape/width/height would be easier to maintain IMHO.