Retreive the Device Information from Windows Phone

Assume that you need to retrieve some device information from Windows Phone. You can get them from the classes “DeviceExtendedProperties” and “DeviceStatus” defined in the Microsoft.Phone.Info namespace.

Note that i am using the Real Windows Phone Device to retreive the information .

How to Retreive the Device Information from Windows Phone ?

The DeviceExtendedProperties allows the App to retreive the info about the device on which it is running .

With the DeviceExtendedProperties , it is possible to get the device info from the following properties

  • DeviceName
  • DeviceUniqueId
  • DeviceManufacturer
  • ApplicationCurrentMemoryUsage
  • ApplicationPeakMemoryUsage
  • DeviceName
  • DeviceUniqueId
  • DeviceFirmwareVersion
  • DeviceHardwareVersion
  • DeviceTotalMemory

We can use the TryGetValue method of the DeviceExtendedProperties class to get the info as below .

  public void GetDeviceName()
  {
        string output = string.Empty;
        object MyDeviceName;
        if (DeviceExtendedProperties.TryGetValue("DeviceName", out MyDeviceName)) { output = MyDeviceName.ToString(); }

        MessageBox.Show(MyDeviceName.ToString());
  }

The DeviceExtendedProperties was the one that was used in the WP7 but with the WP7.1 SDK , it is suggested to use the DeviceStatus instead .

According to MSDN Documentation .

“DeviceExtendedProperties is deprecated. Use DeviceStatus instead.”

In Windows Phone Mango , the DeviceStatus static class is used to get the device info .

Apart from the properties like DeviceName , DeviceTotalMemory , DeviceFirmwareVersion , ApplicationCurrentMemoryUsage , ApplicationPeakMemoryUsage , DeviceHardwareVersion , DeviceManufacturer , the devicestatus also provides the provides following properties

  • IsKeyboardDeployed
  • IsKeyboardPresent
  • PowerSource .

You can also get the Windows Phone Operating System Version number from Environment.OSVersion .

public MainPage()
   {
            InitializeComponent();
            GetDeviceInfo();

   }

   public void GetDeviceInfo()
   {
            long ApplicationMemoryUsage = DeviceStatus.ApplicationCurrentMemoryUsage;
            long PeakMemoryUsage = DeviceStatus.ApplicationPeakMemoryUsage;
            string FirmwareVersion = DeviceStatus.DeviceFirmwareVersion;
            string HardwareVersion = DeviceStatus.DeviceHardwareVersion;
            string Manufacturer = DeviceStatus.DeviceManufacturer;
            string DeviceName = DeviceStatus.DeviceName;
            long TotalMemory = DeviceStatus.DeviceTotalMemory;
            string OSVersion = Environment.OSVersion.Version.ToString(); ;
            PowerSource powerSource = DeviceStatus.PowerSource;
            AddToList("Memory Usage :" + ApplicationMemoryUsage);
            AddToList("Peak Memory Usage :" + PeakMemoryUsage);
            AddToList("Firmware Version :" + FirmwareVersion);
            AddToList("Hardware Version :" + HardwareVersion);
            AddToList("Manufacturer :" + Manufacturer);
            AddToList("Total Memory :" + TotalMemory);
            AddToList("Power Source:" + powerSource.ToString());
            AddToList("Operating System: Windows Phone " + OSVersion.ToString());

   }

   public void AddToList(string Property)
   {
            lstboxDeviceInfo.Items.Add(Property);
   }   
How to Retreive the Device Information from Windows Phone ?

Note that the device OS Version we get is 7.1 but the Phone has 7.5 defined in the settings .

How to Retreive the Device Information from Windows Phone ?


Reference :

    1 Comment

  1. TruckHax
    October 1, 2011
    Reply

    thanks

Leave A Reply

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

You May Also Like

This blog post will guide you through several effective methods to troubleshoot and resolve the issue of Microsoft Edge not...
Windows 11 offers a range of audio enhancements that can enrich your listening experience. These enhancements include features like virtual...
Windows 11 brings a fresh and visually stunning design to your desktop, and one of the standout features is the...