在一个UWP应用设备ID(阈值1) [英] Device ID in a UWP app (threshold 1)

查看:152
本文介绍了在一个UWP应用设备ID(阈值1)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在电话8.1你可以得到使用的 HardwareIdentification ,即使在文档说,它存在的桌面应用程序,它不能用于UWP应用存在。

In Phone 8.1 you could get the device ID using HardwareIdentification, and even though the documentation says it exists for Desktop apps, it does not exist for a UWP app.

什么是替代还是一种方式来获得一个硬件ID对于UWP?

What is the alternative or a way to get a hardware ID for a UWP?

推荐答案

您正在运行到一个共同的问题,从迁移应用程序当Windows(电话)8(0.1)的Windows通用平台

You're running into a common issue when migrating an app from Windows (Phone) 8(.1) to the Windows Universal Platform.

原因你没有看到 HardwareIdentification 很简单:你不引用所需的源

The reason you're not seeing the HardwareIdentification is pretty simple: You don't reference the required sources!

您只看 AnalyticsInfo AnalyticsVersionInfo 。这是因为他们在通用 器件系列的一部分的,因为文档页面上注明(的 https://msdn.microsoft.com/en-us/library/windows/apps/windows.system.profile.analyticsinfo.aspx )在最底层。

You only see AnalyticsInfo and AnalyticsVersionInfo. This is because they are part of the Universal Device Family, as stated on the documentation page (https://msdn.microsoft.com/en-us/library/windows/apps/windows.system.profile.analyticsinfo.aspx) at the very bottom.

HardwareIdentification 然而,这不是在通用器件系列的,它的桌面移动系列的一部分,阿德里亚诺alread 。在他的评论中指出

The HardwareIdentification however is not part of the Universal Device Family, it's part of the Desktop and Mobile family, as Adriano alread stated in his comment.

为使信息可用,您必须将引用添加到特定的扩展:

To make the info available, you have to add the references to the specific extensions:

之后,确认,检查,如果该类型存在之前调用它:

After that, make sure to check if the type exists, before calling it:

if (Windows.Foundation.Metadata.ApiInformation
    .IsTypePresent("Windows.System.Profile.HardwareIdentification"))

这篇关于在一个UWP应用设备ID(阈值1)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆