UWP 应用中的设备 ID(阈值 1)

2024-05-08

在 Phone 8.1 中,您可以使用以下方式获取设备 ID硬件识别 https://stackoverflow.com/questions/23321484/device-unique-id-in-windows-phone-8-1/23322202#23322202,并且即使文档 https://msdn.microsoft.com/en-us/library/windows/apps/windows.system.profile.hardwareidentification.aspx说它存在于桌面应用程序中,但它不存在于 UWP 应用程序中。

获取 UWP 硬件 ID 的替代方案或方法是什么?


从以下位置迁移应用程序时,您会遇到一个常见问题:Windows (Phone) 8(.1) to the Windows Universal Platform.

你没有看到的原因HardwareIdentification非常简单:您没有引用所需的来源!

你只看到AnalyticsInfo and AnalyticsVersionInfo。这是因为它们是普遍的 设备系列,如文档页面所述(https://msdn.microsoft.com/en-us/library/windows/apps/windows.system.profile.analyticsinfo.aspx https://msdn.microsoft.com/en-us/library/windows/apps/windows.system.profile.analyticsinfo.aspx)在最底部。

The HardwareIdentification但不属于普遍的 设备系列,它是Desktop and Mobile家庭,正如阿德里亚诺在他的评论中所说的那样。

To make the info available, you have to add the references to the specific extensions: enter image description here

之后,请确保在调用之前检查该类型是否存在:

if (Windows.Foundation.Metadata.ApiInformation
    .IsTypePresent("Windows.System.Profile.HardwareIdentification"))
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

UWP 应用中的设备 ID(阈值 1) 的相关文章

随机推荐