的Windows Phone 8下获得唯一的设备ID(UDID) [英] Get Unique Device ID (UDID) under Windows Phone 8

查看:115
本文介绍了的Windows Phone 8下获得唯一的设备ID(UDID)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有唯一的设备ID(UDID)或任何类似的ID,我可以在Windows Phone 8(WP8)读出不与硬件改动,应用程序,重新安装等等?

改变

在较早的Windows版本的手机有这样的标识:
WP7: Windows Phone的设备状态

WP7.1:<一href=\"http://msdn.microsoft.com/en-us/library/microsoft.phone.info.devicestatus%28v=vs.92%29.aspx\">DeviceStatus类

但他们不会与SDK 8.0管用了。

为什么我问:
这个想法是,用户得到一些免费的学分与该应用程序的第一个开始,我希望避免用户只需重新安装用于获取新的免费学分的应用程序。与电子邮件或电话号码的注册可以解决这个问题,但如果我可以,我不想做的第一次启动了注册用户的麻烦。

/// --- --- SOLUTION ----------

我可以证实,DeviceExtendedProperties.GetValue(DeviceUniqueId)仍然工作在WP 8.0。得到了当我读到下面的文字有点困惑:


  

在的Windows Phone OS 7.0,这个类是用于查询设备特定
  属性。在的Windows Phone OS 7.1,大部分属性的
  DeviceExtendedProperties被德precated,并且新DeviceStatus
  类应改为使用。然而,在适当情况下,你可以
  仍然使用以下任何属性都没有去precated的。


<一个href=\"http://msdn.microsoft.com/en-us/library/windowsphone/develop/microsoft.phone.info.deviceextendedproperties%28v=vs.105%29.aspx\">MSDN:DeviceExtendedProperties类

我可以运行下面的code,删除该应用程序,并重新安装,并得到相同的ID:

 字节[] = myDeviceID(字节[])Microsoft.P​​hone.Info.DeviceExtendedProperties.GetValue(DeviceUniqueId);
字符串DeviceIDAsString = Convert.ToBase64String(myDeviceID);
MessageBox.Show(DeviceIDAsString);


解决方案

我还没有开始开发Windows Phone 8的,仍然在7,但你还是应该能够使用原来的<一个href=\"http://msdn.microsoft.com/en-us/library/windowsphone/develop/microsoft.phone.info.deviceextendedproperties%28v=vs.105%29.aspx\">DeviceExtendedProperties类拉回设备的唯一ID。

  DeviceExtendedProperties.GetValue(DeviceUniqueId)

Is there any unique device ID (UDID) or any similar ID I can read out on Windows Phone 8 (WP8) that doesn't change with hardware changes, app-reinstallation etc.?

In older Windows Phone versions there were such IDs: WP7: Device Status for Windows Phone

WP7.1: DeviceStatus Class

But they doesn't work anymore with SDK 8.0.

Why I ask: The idea is that a user gets some free credits with the first start of the the app and I want to avoid that the user just re-installs the app for getting new free credits. A registration with email or phone number could solve this, but if I can, I don't want do bother users at the first start with a registration.

---///---SOLUTION----------

I can confirm that DeviceExtendedProperties.GetValue("DeviceUniqueId") still works in WP 8.0. Got a little bit confused when I read the following text:

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

I can run the following code, delete the app and re-install it and get the same ID:

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

解决方案

I haven't yet started to develop for Windows Phone 8, still on 7, but you still should be able to use the original DeviceExtendedProperties class to pull back the Device Unique ID.

DeviceExtendedProperties.GetValue("DeviceUniqueId")

这篇关于的Windows Phone 8下获得唯一的设备ID(UDID)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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