Device Unique id in Windows Phone 8.1

MohanRajNK picture MohanRajNK · Apr 27, 2014 · Viewed 12.2k times · Source

How to get the device unique id in Windows Phone 8.1? The old way of using DeviceExtendedProperties.GetValue("DeviceUniqueId") does not work for Windows Universal app.

Answer

thongaduka picture thongaduka · May 8, 2014
private string GetDeviceID()
{
    HardwareToken token = HardwareIdentification.GetPackageSpecificToken(null);
    IBuffer hardwareId = token.Id;

    HashAlgorithmProvider hasher = HashAlgorithmProvider.OpenAlgorithm("MD5");
    IBuffer hashed = hasher.HashData(hardwareId);

     string hashedString = CryptographicBuffer.EncodeToHexString(hashed);
     return hashedString;
}

Hope this help !