Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

get the ID of the current windows phone 7 device

Is there a way that I can uniquely identify the windows phone device that my app is running on? Is there a windows phone device ID or something?

like image 999
BrokeMyLegBiking Avatar asked Dec 20 '10 04:12

BrokeMyLegBiking


3 Answers

Try:

DeviceExtendedProperties.GetValue("DeviceUniqueId")

http://msdn.microsoft.com/en-us/library/ff941122(v=VS.92).aspx

like image 66
Mike Chamberlain Avatar answered Nov 13 '22 16:11

Mike Chamberlain


object uniqueID;
if (Microsoft.Phone.Info.DeviceExtendedProperties.TryGetValue("DeviceUniqueId", out uniqueID)==true) {
  byte[]bID=(byte[])uniqueID;
  string deviceID=Convert.ToBase64String(bID);   // There you go
}
like image 36
eslyverano Avatar answered Nov 13 '22 15:11

eslyverano


Or you can use a globally unique identifier (GUID) in general http://msdn.microsoft.com/en-us/library/system.guid.aspx And save that ID on local storage.

deviceID = Guid.NewGuid();
IsolatedStorageSettings.ApplicationSettings["DeviceId"] = deviceID;
like image 4
404Dreamer_ML Avatar answered Nov 13 '22 14:11

404Dreamer_ML