4
votes

I use the DeviceUniqueId property of the DeviceExtendedProperties object to identify a device on my Windows Phone apps.

On Windows Phone 7, it worked perfectly, and the device id remained stable across all the apps.

I migrated my apps to Windows Phone 8 (targeting both WP7 and 8), and it still worked as usual.

However, I've just developed an app that only targets WP8, and I have noticed that the DeviceUniqueId is different than the one of my other apps (running on the same device).

To be sure, I created a few other test apps.

Here is an example on the same device (Nokia Lumia 820) :

  • App1 (targets WP7 & 8), device id : 422c3795ae12b92b18882bd93ea454b3
  • App2 (targets WP7 & 8), device id : 422c3795ae12b92b18882bd93ea454b3
  • App3 (targets WP8 only), device id : 19ff7b4c669b1cbeaf0e42ab1e6796ea
  • App4 (targets WP8 only), device id : 240fe4501de11078313a63dde118d9ae

Is this intended ? Is it possible to get a fixed device id for the WP8-only apps ?

I am unable to find any formal documentation about this behavior on MSDN.

Thanks.

2

2 Answers

1
votes

For Windows Phone 8, definition on MSDN is:

For Windows Phone 8 apps running on Windows Phone 8 devices and later, the DeviceUniqueId value is unique per device and per app publisher. For Windows Phone 8 apps, DeviceUniqueId is functionally identical to the HostInformation.PublisherHostId property in the Windows Runtime.

Link to MSDN - DeviceExtendedProperties Class

2
votes

According to the official MSDN document:

DeviceUniqueId - A unique hash for the device. This value will be constant across all applications and will not change if the phone is updated with a new version of the operating system. Applications should not use this to identify users because the device ID will remain unchanged even if ownership of the device is transferred.

In Windows Mobile 6.5 the hash was app-specific. This is not the case for Windows Phone. That being said, however, the ID is publisher-specific. Try changing the publisher GUID in the manifest and you will see what happens.