Check device type

Former Member
Former Member
How can I check the type of the device? Or at least, how can I check if my widget is ran on a round / square watch?

Thanks in advance!
  • How can I check the type of the device? Or at least, how can I check if my widget is ran on a round / square watch?

    Thanks in advance!


    I don't think there is a 'standardized' way of doing this yet... which IMHO is a pretty big omission.

    However, you can hack around it by using device-specific resources.

    What you do is:

    1. Create a resource directory called 'resources-<device-name>' e.g. 'resources-d2bravo'.

    2. Inside that directory, override 'strings.xml' to include a value for a device key, e.g.
    <string id="device">d2bravo</string>


    3. Now check that value to determine roundness, e.g.

    function initialize() {
    mDevice = Ui.loadResource(Rez.Strings.device);
    }

    function isRoundWatch() {
    return mDevice.equals("fenix3") || mDevice.equals("d2bravo");
    }
  • Another way (that works for now at least) for square vs round, is check the width and height (dc.getWidth(),dc.getHeight())

    if they are both 218, you have a round one (f3 family)

    if it's 205x148 (or NOT 218x218, or h!=w) it's a square one (va, 920, Epix)
  • Former Member
    Former Member over 9 years ago
    Thanks very much!