Windows Phone 8获取设备ID

来源:互联网 发布:触摸屏编程用什么软件 编辑:程序博客网 时间:2024/04/30 00:15

转自:http://linzr33.blog.163.com/blog/static/57380282013108113827209/

How to Get Unique Device ID from Windows Phone Using C#?

// get the unique device id for the publisher per deviceprivate void mGetDeviceUniqueId()        {            byte[] result = null;            object uniqueId;            if (Microsoft.Phone.Info.DeviceExtendedProperties.TryGetValue("DeviceUniqueId", out uniqueId))            {                result = (byte[])uniqueId;            }            //转换设备ID为字符串            if (result != null)            {                AppSetting.getDeviceUniqueId = Convert.ToBase64String(result);            }        }

Note that , in Windows Phone 8 , you need to enable the “ID_CAP_IDENTITY_DEVICE” capability in your windows phone app manifest file for the above code snippet to work.


0 0