gpt4 book ai didi

c# - 在 Windows Phone 8 下获取唯一设备 ID (UDID)

转载 作者:IT王子 更新时间:2023-10-29 03:51:52 25 4
gpt4 key购买 nike

是否有任何唯一设备 ID (UDID) 或我可以在 Windows Phone 8 (WP8) 上读取的任何类似 ID,这些 ID 不会随着硬件更改、应用程序重新安装等而改变?

在旧的 Windows Phone 版本中有这样的 ID:WP7:Device Status for Windows Phone

WP7.1:DeviceStatus Class

但它们不再适用于 SDK 8.0。

我为什么问:这个想法是用户在第一次启动应用程序时获得一些免费积分,我想避免用户只是重新安装应用程序以获得新的免费积分。使用电子邮件或电话号码注册可以解决此问题,但如果可以的话,我不想在第一次注册时打扰用户。

---///---解决方案------------

我可以确认 DeviceExtendedProperties.GetValue("DeviceUniqueId") 在 WP 8.0 中仍然有效。当我阅读以下文字时有点困惑:

In Windows Phone OS 7.0, this class was used to query device-specific properties. In Windows Phone OS 7.1, most of the properties in DeviceExtendedProperties were deprecated, and the new DeviceStatus class should be used instead. However, where appropriate, you can still use any of the below properties that are not deprecated.

MSDN:DeviceExtendedProperties Class

我可以运行以下代码,删除应用程序并重新安装它并获得相同的 ID:

byte[] myDeviceID = (byte[])Microsoft.Phone.Info.DeviceExtendedProperties.GetValue("DeviceUniqueId");
string DeviceIDAsString = Convert.ToBase64String(myDeviceID);
MessageBox.Show(DeviceIDAsString);

最佳答案

我还没有开始为 Windows Phone 8 开发,仍在 7,但你仍然应该能够使用原来的 DeviceExtendedProperties类来拉回设备唯一 ID。

DeviceExtendedProperties.GetValue("DeviceUniqueId")

关于c# - 在 Windows Phone 8 下获取唯一设备 ID (UDID),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13975315/

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