c# - 唯一设备 ID UWP

标签 c# windows-phone win-universal-app uniqueidentifier

几天以来,我尝试从我的 Windows Phone 设备获取 MAC 地址,但没有成功。我正在尝试为我的手机、平板电脑等获取唯一 ID。我找到了 HardwareToken 类和下面的代码

HardwareToken token = HardwareIdentification.GetPackageSpecificToken(null);
                IBuffer hardwareId = token.Id;
                HashAlgorithmProvider hasher = HashAlgorithmProvider.OpenAlgorithm("MD5");
                IBuffer hashed = hasher.HashData(hardwareId);
                string hashedString = CryptographicBuffer.EncodeToHexString(hashed);

使用此代码我正在接收ASHWID。这真的很独特吗?

最佳答案

Using this code I am receiving ASHWID. Is that really unique?

这要看情况。在手机/平板电脑上比在桌面上更有可能。确切答案你可以找到at MSDN :

The ASHWID provides a strong binding between the app/package and the device by representing several individual hardware characteristics. In order to protect user privacy, the ASHWID varies from app to app. Unless the underlying hardware has changed, two calls from the same app will result in identical ASHWIDs. However, the ASHWID changes if the hardware profile of the device changes, such as when the user unplugs a USB Bluetooth adapter. The back-end cloud service can verify the ASHWID and compare it with previously reported values.

已关注 Peter's Torr answer您还应该首先检查实际设备上是否存在该 API。尽管您也可以考虑他的建议 - 思考这是否真的能解决您的问题。

关于c# - 唯一设备 ID UWP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34153786/

相关文章:

c# - LINQ:获取所有子项总和的有效方法

c# - 防止打包 .Net 可执行文件的内存转储?

c# - Xsd.exe 或 Svcutil.exe 将 XSD 架构转换为类

c# - OpenCV + 安卓 + Unity

windows-phone-7 - 为 Windows Phone 7 创建自定义 InputScope

c# - Windows 10移动版UWP-慢速后退按钮

installation - Windows 10 IOT 通用 Windows 应用程序,我如何以编程方式安装应用程序

xaml - 检测 ListView 中滚动的结束

windows-phone-7 - 工具栏中没有列表框项目

c# - 如何摆脱 GridView UWP 的框选择边框