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 4251 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.

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.

Leave a Comment


x

You might be Interested in these Posts

C# and Lambda - Finding all the elements of an integer array less than 35

Here's a sample code snippet demonstrating how to find all the elements of an integer array that is ...

C# and LINQ - Finding all the elements of an integer array less than 35

Here's a sample code snippet demonstrating how to find all the elements of an integer array that is ...

How to get the CommandLine of the Current Application in C# ?

You might need to get the information that contains the commandline which is used to execute the cur...