Determining device type at runtime possible?

Is there a way to determine the device type at runtime?
  • Right now, this isn't available in the API. It has been requested before, though (e.g. here), and it's something we've got on the books for consideration.
  • Former Member
    Former Member over 10 years ago
    You can do this at compile time, using resource qualifiers. Since the store automatically pushes the correct version to the device, the result will be the same.
    This goes as follows:

    In your resource file add:

    resources>
    <string id="deviceType">undetermined</string>
    </resources>


    Add device specific folders, for instance "resources-fr920xt" and within that folder create a new resources file (see documentation page 36):

    <resources>
    <string id="deviceType">fr920xt</string>
    </resources>


    Do this for every type of device that you want to support.
    If you read the resource value at runtime, you'll get "fr920xt" on a forerunner 920xt and "undetermined" on a device that you don't support.