Finding the Device Model on Windows Phone 7

Previously i detailed how to retrieve the Device Manufacturer and users anonymous id from the device here.  This post details how to capturing the Device Model on Windows Phone 7.

Step 1: Add the ID_CAP_IDENTITY_DEVICE capability to your WMAppManifest.xml

<Capabilities>
   <Capability Name="ID_CAP_IDENTITY_DEVICE"/>
   ...
</Capabilities>

Step 2: Use the DeviceName with DeviceExtendedProperties TryGetValue method as follows:

public static string GetDeviceModel()
{
   string model = null;
   object theModel = null;

   if (Microsoft.Phone.Info.DeviceExtendedProperties.TryGetValue("DeviceName", out theModel))
      model = theModel as string;      

   return model
}

The resulting Model of my device is T8697.

If you are interested in how to access your Applications ProductID, yep the one that can change during marketplace certification please see Nick Randolphs Blog here.

Enjoy,
Nick

  • http://www.facebook.com/leye0 Léon Pelletier

    return model; // :P