Varje Windows Phone telefon har ett unik id. Detta är ett id som är 20 bytes långt. I beskrivningen i dokumentationen står det att detta id:
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.
Nå, hur får man tag på detta då?
object deviceIdObject; byte[] deviceId; if (DeviceExtendedProperties.TryGetValue("DeviceUniqueId",
out deviceIdObject))
{
deviceId = (byte[])deviceIdObject;
MessageBox.Show(Convert.ToBase64String(deviceId));
}
Observera att följande capability måste finnas i WMAppManifest.xml för att detta skall fungera:
<Capability Name="ID_CAP_IDENTITY_DEVICE"/>
Recent Comments