2011年12月21日 星期三

Finding the Unique Device ID in Windows Phone 7 (And Device Manufacturer And Anonymous Windows Live ID)


  • 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”
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.
Reference To:

沒有留言:

張貼留言