我是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