我是Windows 8商店应用程序的新手,需要在我的一个XAML项目中获取设备ID。此设备ID应该是唯一的。我搜索了互联网,发现了两种不同的方式。在C#代码在VS2012中获取唯一的设备ID Windows 8商店应用程序
首先方式,在C#代码
private string GetHardwareId()
{
var token = HardwareIdentification.GetPackageSpecificToken(null);
var hardwareId = token.Id;
var dataReader = Windows.Storage.Streams.DataReader.FromBuffer(hardwareId);
byte[] bytes = new byte[hardwareId.Length];
dataReader.ReadBytes(bytes);
return BitConverter.ToString(bytes);
}
方式二,
var easClientDeviceInformation = new Windows.Security.ExchangeActiveSyncProvisioning.EasClientDeviceInformation()
GUID deviceId = easClientDeviceInformation.Id;
第一个比特格式给出,而第二个给出GUID。我不知道哪一个是正确的。
我提到这个blog
和MSDN link了。
任何人可以指导我关于哪些可以用作设备ID?
[UDID for windows 8]的可能重复(http://stackoverflow.com/questions/16893746/udid-for-windows-8) – Xyroid