来自C ++ / CX的设备唯一ID

时间:2013-04-05 09:26:57

标签: c++ .net windows-phone-8 c++-cx

我可以从WP8上的C ++ / CX代码获取device unique id(UDID)吗?或者,如果我不这样做,我该怎么办呢?我已经尝试使用DeviceExtendedProperties(它不起作用,可能只是.net类)。

1 个答案:

答案 0 :(得分:0)

您可以使用HardwareIdentification.GetPackageSpecificToken方法获取特定于您的应用的设备唯一ID。它有一些复杂性,因为ID的值取决于许多系统因素,如可用内存,连接的外围设备(想想蓝牙耳机),网络连接等 - 请务必阅读链接的文档!更深入地讨论硬件ID can be found here的组件。

该值对于您的应用和特定设备的组合而言是唯一的,这很可能足以用于应用开发目的。

请注意,此API需要WP 8.1" Windows Runtime"应用程序,并且不适用于WP8 Silverlight应用程序。

using namespace Windows::System::Profile;

...

IBuffer^ nonce = ...; // optional, see documentation
HardwareToken^ hwid = HardwareIdentification::GetPackageSpecificToken(nonce);

// HardwareToken has a few properties, but the one you're likely interested
// in is HardwareToken.
IBuffer^ id = hwid->Id;
相关问题