由於WP7SKD不提供獲取機子IMEI的方法,所以無法得到機子IMEI,但是SDK提供一另一個獲取唯一ID的方法,在Microsoft.Phone.Info.DeviceExtendedProperties裏面的DeviceUniqueId。
通過這個方法可以獲得
public static String GetDeviceUniqueID()
{
object DeviceUniqueID;
byte[] DeviceIDbyte = null;
if (DeviceExtendedProperties.TryGetValue("DeviceUniqueId", out DeviceUniqueID))
DeviceIDbyte = (byte[])DeviceUniqueID;
string DeviceID = Convert.ToBase64String(DeviceIDbyte);
return DeviceID;
}
但是爲了更加保險,推薦加上用戶的Windows Live ID一起保存,這樣絕對是唯一的了。