Windows Phone 7 includes the DeviceExtendedProperties class that you can use to obtain information about the physical device. The information you can retrieve includes the following:
- The device manufacturer, the device name, and its unique device ID
- The version of the phone hardware and the version of the firmware running on the phone
- The total physical memory (RAM) installed in the device, the amount of memory currently in use, and the peak memory usage of the current application
However, you must be aware that the phone will alert the user when some device information is retrieved and the user can refuse to allow the application to access it. You should access device information only if it is essential to your application. Typically, you will use device information to generate statistics or usage data, and to monitor memory usage of your application. You can use this data to adjust the behavior of your application to minimize impact on the device and other applications.
You retrieve device information using the GetValue or the TryGetValue method, as shown in the following code example.
string manufacturer = DeviceExtendedProperties.GetValue(
string deviceName = DeviceExtendedProperties.GetValue(
string firmwareVersion = DeviceExtendedProperties.GetValue(
string hardwareVersion = DeviceExtendedProperties.GetValue(
long totalMemory = Convert.ToInt64(
long memoryUsage = Convert.ToInt64(
long peakMemoryUsage = -1;
peakMemoryUsage = Convert.ToInt64(tryValue);
// The following returns a byte array of length 20.
object deviceID = DeviceExtendedProperties.GetValue(
The device ID is a hash represented as an array of 20 bytes, and is unique to each device. It does not change when applications are installed or the firmware is updated.
When running in the emulator, the manufacturer name returns “Microsoft,” the device name returns “XDeviceEmulator,” and (in the initial release version) the hardware and firmware versions return 0.0.0.0.
For more information, and a list of properties for the Device ExtendedProperties class, see “Device Information for Windows Phone” on MSDN (http://msdn.microsoft.com/en-us/library/ff941122(VS.92).aspx).