Over a million developers have joined DZone.

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

DZone's Guide to

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

· Mobile Zone
Free Resource

Get gorgeous, multi-touch charts for your iOS application with just a few lines of code.

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 and few other pieces of device information.

Below is a sample sourcecode that lets you get the unique id 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);


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

.Net developers: use Highcharts, the industry's leading interactive charting library, without writing a single line of JavaScript.


Published at DZone with permission of Senthil Kumar, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.


Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.


{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}