Reputation: 1047
Why is the Capability ID_CAP_IDENTITY_DEVICE is missing in Wp8.1? Due to this I am not able to get Device ID matching the one i am getting in WP8!
And this in turn is causing lot of issues in App Upgradation!
Now I am using,
HardwareToken token = HardwareIdentification.GetPackageSpecificToken(null);
IBuffer hardwareId = token.Id;
HashAlgorithmProvider hasher = HashAlgorithmProvider.OpenAlgorithm("MD5");
IBuffer hashed = hasher.HashData(hardwareId);
string DeviceId = CryptographicBuffer.EncodeToHexString(hashed);
return DeviceId ;
Previously we used,
DeviceExtendedProperties.TryGetValue("DeviceUniqueId", out uniqueId);
result = (byte[])uniqueId;
string id = Convert.ToBase64String(result).Replace("=", "").Replace("/", "").Replace("+", "");
return id + "";
Please suggest a solution so that we can get similar IDs in both platforms!
All help and suggestions appreciated.
Upvotes: 1
Views: 1443
Reputation: 1092
If you are developing a Windows Phone 8.1 XAML app, it wont support ID_CAP_IDENTITY_DEVICE as it can be deployed on any device ie phone, tablet or desktop. So instead you can use the HardwareIndentification class to get device ID
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;
}
This may be helpful. Guidance on using the App Specific Hardware ID (ASHWID) to implement per-device app logic
Upvotes: 6