Get Unique Device Id of Windows Phone 8

By | March 2, 2014

To get Unique device Id of Windows Phone 8 we are using Microsoft.Phone.Info Class. May be the same code is working in Windows Phone 7.5  but in case of  WP8 you will get some error to get details. We are also providing step to resolve the issue.

Create Windows Phone Project
Screenshot (64)

Add button and write code to get device Id in popup

private void Go_Click(object sender, RoutedEventArgs e)

byte[] uniqueIDbytes = (byte[])DeviceExtendedProperties.GetValue(“DeviceUniqueId”);
string uniqueID = System.Convert.ToBase64String(uniqueIDbytes);
MessageBox.Show(“myDeviceID:” + uniqueID);

Screenshot (65)

When you  run this code may be you will get an error :

An exception of type ‘System.UnauthorizedAccessException’ occurred in but was not handled in user code”

Screenshot (68)


To Resolve this  issue  Go to WMAppManifest.xml and within the Capabilities tab ensure you have checked



Now Run the code and you will get Unique Device Id