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 5537 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 download a file from a URL using C#?

You can use the WebClient class in C# to download a file. How to download a file from a URL using C...

How to Create an Empty array without defining the size in C# ?

When we create an array in C# , we tend to define the size of the array as shown below. String[] st...

C++ Program to display "Hello, World!"

Problem Write a program in C++ to display "Hello, World!" on the screen. C++ Program to...