gpt4 book ai didi

c# - WP8.1 功能中缺少 ID_CAP_IDENTIY_DEVICE

转载 作者:太空宇宙 更新时间:2023-11-03 19:07:23 25 4
gpt4 key购买 nike

为什么 Wp8.1 中缺少 Capability ID_CAP_IDENTITY_DEVICE?因此,我无法获得与我在 WP8 中获得的设备 ID 匹配的设备 ID!

这反过来会导致应用升级出现很多问题!

现在我在用,

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 ;

以前我们用过,

DeviceExtendedProperties.TryGetValue("DeviceUniqueId", out uniqueId);
result = (byte[])uniqueId;
string id = Convert.ToBase64String(result).Replace("=", "").Replace("/", "").Replace("+", "");
return id + "";

请提出一个解决方案,以便我们可以在两个平台上获得相似的 ID!

感谢所有帮助和建议。

最佳答案

如果您正在开发 Windows Phone 8.1 XAML 应用程序,它将不支持 ID_CAP_IDENTITY_DEVICE,因为它可以部署在任何设备上,例如手机、平板电脑或台式机。因此,您可以使用 HardwareIndentification 类来获取设备 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;
}

这可能会有帮助。 Guidance on using the App Specific Hardware ID (ASHWID) to implement per-device app logic

关于c# - WP8.1 功能中缺少 ID_CAP_IDENTIY_DEVICE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25011274/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com