How to get the UniqueID of the Windows Phone device using C# ?

In Windows Phone 7 , the developers can take advantage of the class DeviceExtendedProperties to get the unique id of the device .

The DeviceExtendedProperties which is part of the Microsoft.Phone.Info assembly also can be used to retreive the total memory , memory usage ,Device Name , Firmware version , hardware version etc and few other device information .

Below is a sample sourcecode that lets you get the uniqueid of the Device . It uses the extended device property list “DeviceUniqueID” to retreive the unique ID

object DeviceUniqueID;

byte[] DeviceIDbyte=null;

if (DeviceExtendedProperties.TryGetValue("DeviceUniqueId", out DeviceUniqueID))

DeviceIDbyte = (byte[])DeviceUniqueID;

string DeviceID = Convert.ToBase64String(DeviceIDbyte);

MessageBox.Show(DeviceID);

You should add the below entry to your WMAppManifest.xml file of your WP7 Project to actually get the Unique ID

When the above entry is missing in the xml file , you will get an UnauthorizedAccessException or Argument null Exception “Value can not be null.”

Reference : Device Information for Windows Phone

If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.
Pin It

6 thoughts on “How to get the UniqueID of the Windows Phone device using C# ?

  1. Pingback: How to get the UniqueID of the Windows Phone device using C | ProgramInDotnet

  2. Pingback: How to get the DeviceName and the ManufacturerName of the Windows Phone device using C#

  3. Pingback: How to get the DeviceName and the ManufacturerName of the Windows Phone device using C# ? | Windows Phone Rocks

  4. Pingback: How to get the UniqueID of the Windows Phone device using C# ?MobileOSGeek

  5. Pingback: How to get the DeviceName and the ManufacturerName of the Windows Phone device using C# ?MobileOSGeek

  6. Pingback: Interesting .NET Links - May 3 , 2011 | TechBlog

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>