Get a unique device identifier (UDID) for Windows Phone 8

Is there a unique device identifier (UDID) or any similar identifier that I can read on Windows Phone 8 (WP8) that does not change with hardware changes, reinstalling applications, etc.?

In older versions of Windows Phone there were such IDs: WP7: Device Status for Windows Phone

WP7.1: DeviceStatus Class

But with SDK 8.0 they no longer work.

Why I ask: The idea is that the user receives free credits from the first launch of the application, and I want to avoid the fact that the user simply reinstalls the application to receive new free credits. Registering by email or phone number can solve this problem, but if I can, I don’t want users to worry when they first start with registration.

---///--- Decision ----------

I can confirm that DeviceExtendedProperties.GetValue ("DeviceUniqueId") still works in WP 8.0. I was a little embarrassed when I read the following text:

In Windows Phone OS 7.0, this class was used to request device-specific properties. On Windows Phone 7.1, most of the properties in DeviceExtendedProperties are deprecated, and the new DeviceStatus class should be used instead. However, if necessary, you can still use any of the properties listed below that are not outdated.

MSDN: class DeviceExtendedProperties

I can run the following code, uninstall the application and reinstall it and get the same ID:

byte[] myDeviceID = (byte[])Microsoft.Phone.Info.DeviceExtendedProperties.GetValue("DeviceUniqueId"); string DeviceIDAsString = Convert.ToBase64String(myDeviceID); MessageBox.Show(DeviceIDAsString); 
+47
c # windows-phone-7 windows-phone-8
Dec 20
source share
9 answers

I have not started developing Windows Phone 8, still at 7, but you should still use the original DeviceExtendedProperties class to pull back to return a unique device identifier.

 DeviceExtendedProperties.GetValue("DeviceUniqueId") 
+31
Dec 20 '12 at 18:20
source share

I am having a problem returning a null value. Then I remembered that it should be turned on.

In WMAppManifest.xml Capabilities tab -> enable ID_CAP_IDENTITY_DEVICE

+20
Jan 20 '13 at 19:44
source share

There is a twist to this DeviceUniqueId - it is unique to only one publisher. Thus, this is not a unique device identifier, but a unique device identifier for a single publisher. We noticed that when we were working on some kind of client project, where we tried to identify the same phone from different accounts (the client is published in two different accounts).

+8
Mar 12 '13 at 9:01
source share

You can get your own wp8 device id with DeviceExtendedProperties.GetValue ("DeviceUniqueId") Here is an easy way to get deviceId as a string

 byte[] id = (byte[])Microsoft.Phone.Info.DeviceExtendedProperties.GetValue("DeviceUniqueId"); string deviceID = Convert.ToBase64String(id); 
+4
Dec 11 '13 at 6:54
source share

By not providing DeviceUniqueId on Windows Phone 8 and Windows 8, Microsoft tried to avoid tracking users, but with increased pressure from the Dev community, they returned it again.

In Windows 8.1, Microsoft introduced the new AdvertisingId API and can also provide a similar identifier to identify a unique user through applications in future versions of Windows Phone 8.1 / 9.

+2
Oct 28 '13 at 17:59
source share

I used this:

  private static String getDeviceId() { byte[] id = (byte[])Microsoft.Phone.Info.DeviceExtendedProperties.GetValue("DeviceUniqueId"); return BitConverter.ToString(id).Replace("-", string.Empty); } 

But the key should check ID_CAP_IDENTITY_DEVICE in WMAppManifest, otherwise it throws an error.

+2
Jan 28 '14 at 8:19
source share
+1
Aug 03 '14 at 1:00 a.m.
source share
 string myDeviceID = (byte[])DeviceExtendedProperties.GetValue("DeviceUniqueId"); string DeviceIDAsString = Convert.ToBase64String(myDeviceID); 

I used this for a unique device identifier for a Windows phone.

+1
Feb 24 '15 at 7:18
source share

The answers above work for Windows Phone 7 and 8 Silverlight. However, they will not work for Windows Phone RT (Universal) or Store Apps, because the SDK does not have a DLL (Microsoft.Phone).

Here's how you get the device ID and name (and possibly other information) in Windows Phone 8.1 RT (Universal / Store Apps).

 private string GetHardwareId() { var token = HardwareIdentification.GetPackageSpecificToken(null); var hardwareId = token.Id; var dataReader = Windows.Storage.Streams.DataReader.FromBuffer(hardwareId); byte[] bytes = new byte[hardwareId.Length]; dataReader.ReadBytes(bytes); return BitConverter.ToString(bytes); } 

I posted a blog post here explaining the differences, and more information on reading device information in Windows RT can be found here.

0
Jul 02 '15 at 5:48
source share



All Articles