During runtime I can check which device family the application is running on with a call to:

string deviceFamily = Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamily;

The function seems to return a so called “magic” string and I haven’t found any list of valid values published by Microsoft. What values does it return? Is there perhaps a better alternative to figure out what device my app is running on? It’s quite important to know since I will make decisions based on the family type. I also would like some type checking during compile time to ensure that I have used a correct value.

I found a page on Microsoft site called “Guide to Universal Windows Platform (UWP) apps” that is referred to whenever I search on TargetDeviceFamily/DeviceFamily or similar. From this page I conclude that there are six families, but still not fully sure how they are identified by above function. While debugging my desktop and mobile and found out two values, “Windows.Desktop” and “Windows.Mobile”. From various sources (contradictory) on Internet, I think the following additional values are used “Windows.Team“, “Windows.IoT“, “Windows.Xbox” and “Windows.Holographic“. Haven’t found a good way to test this. Anyway, I created a utility class that returns an enumeration instead of a magic string (not sure it is 100% correct though).

public static class DeviceFamilies
   public static DeviceFamilyType GetCurrentDeviceFamily()
      string deviceFamily = Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamily;

      switch (deviceFamily)
         case "Windows.Desktop":
            return DeviceFamilyType.Desktop;
         case "Windows.Mobile":
            return DeviceFamilyType.Mobile;
         case "Windows.Team":
            return DeviceFamilyType.Team;
         case "Windows.IoT":
            return DeviceFamilyType.IoT;
         case "Windows.Xbox":
            return DeviceFamilyType.Xbox;
         case "Windows.Holographic":
            return DeviceFamilyType.HoloLens;
            return DeviceFamilyType.Unknown;

public enum DeviceFamilyType


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.