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

Published on October 26, 2013 by abundantcode

Filed under Windows Phone

Last modified October 26, 2013

Print this page

rate 1 star rate 2 star rate 3 star rate 4 star rate 5 star
Your rating: none, Average: 0 (0 votes)

This article have been viewed 7692 times

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.

Leave a Comment


x

You might be Interested in these Posts

How to decode a base64 string in C#?

Here's a sample code snippet demonstrating how you can easily decode a base64 encoded string in C#. ...

How to disable editing of items in a combo box in c#?

When working in Win forms using C# and especially when you use the combo box , you would have notice...

C# Program to find the ASCII Value of a Character

Problem Write a program in Visual C# to find the ASCII value of the input character. How to find t...