How to Get Unique Device ID from Windows Phone 8 Using C#?

Do you want to get the unique device id of the Window phone 8 programatically using C#? , you can do it using the DeviceExtendedProperties defined in the Microsoft.Phone.Info name and use the “DeviceUniqueId” property name to get the device id in byte array and then convert it to base 64 string .

How to Get Unique Device ID from Windows Phone Using C#?

Below is a sample code snippet demonstrating on how to get the unique device ID per device and per publisher using C#.

// get the unique device id for the publisher per device
Byte[] DeviceArrayID = (Byte[])Microsoft.Phone.Info.DeviceExtendedProperties.GetValue("DeviceUniqueId");
string UniqueDeviceID = Convert.ToBase64String(DeviceArrayID);
MessageBox.Show(UniqueDeviceID);

Note that , in Windows Phone 8 , you need to enable the “ID_CAP_IDENTITY_DEVICE” capability in your windows phone app manifest file for the above code snippet to work.

%d bloggers like this: