Finding the Unique Device ID in Windows Phone 7 (And Device Manufacturer And Anonymous Windows Live ID)
I’m tired of trying to find things about Windows Phone 7 development, so I’m just going to post links that I find helpful so I can find them later.
Here’s Nick Harris with a handy set of static methods for getting the following unique IDs:
- Device Manufacturer ID
- DeviceExtendedProperties.TryGetValue(“DeviceManufacturer”, out someObject);
- example: “HTC”
- Device ID
- DeviceExtendedProperties.TryGetValue(“DeviceUniqueId”, out someObject);
- requires ID_CAP_IDENTITY_DEVICE in the app manifest which will trigger a warning to users when they install the app
- a byte[], converter to a string will looks like
“12345678901234567890123456789012345678901234567890123”
- Anonymous Windows Live ID
- A 32 character subset at offset 2 of the results of
“UserExtendedProperties.TryGetValue(“ANID”, out someObject) - requires ID_CAP_IDENTITY_USER in the app manifest which will trigger a warning to users when they install the app
- looks like “00FF00FF00FF00FF00FF00FF00FF00FF”
- A 32 character subset at offset 2 of the results of
However, if you just need any unique identifier (not necessarily a device ID), you can always set and store a new global unique identifier using:
Guid.NewGuid();
which will return a 128-bit integer that will look something like this:
“e81644f1-46b6-4994-2903-1d1f1440c130”
This will not cause warnings to appear when the app is downloaded because it isn’t a constant identifier to that specific device.
This entry was posted in Mango, Silverlight, Silverlight 4, Windows Phone, Windows Phone 7. Bookmark the permalink.
3 Responses to Finding the Unique Device ID in Windows Phone 7 (And Device Manufacturer And Anonymous Windows Live ID)
Pingback: Finding the Unique Device ID in Windows Phone 7 (And Device Manufacturer And Anonymous Windows Live ID) « Silverlight News
Nice post.Thanks For Sharing.Its Nice to have WP7 is primarily focused on the consumer market rather than the enterprise market. Incorporated with its unique tiles based User Interface (UI), WP7 moves a step ahead from traditional concept of icons.
Pingback: Dew Drop – December 21, 2011 (#1,224) | Alvin Ashcraft's Morning Dew