Silverlight Feeds - All your Silverlight feeds in one place.

Sponsors

Sunday, September 19, 2010

[WP7] How to get Windows Phone Device unique identifier

by Corrado Cavalli via Corrado's BLogs on 9/19/2010 7:10:28 AM

Una delle domande più ricorrenti relative a Windows Phone 7 è:  Esiste la possibilità di identificare in maniera univoca un device? (attenzione: ho scritto device, non utente…) la risposta è si, attraverso la classe DeviceExtendedProperties la quale espone una lunga serie di informazioni interessanti come Memoria totale, Memoria occupata, Versione firmare e hardware etc…
Personalmente per comodità mi sono wrappato tutto in una classe DeviceInformation e ho convertito i 20 bytes che identificano il device in un unsigned integer, attenzione che la chiamata ritorna un UnAuthorizedAccessException se non avete attivato ID_CAP_IDENTITY_DEVICE in WMAppManifest.xml


Ecco un estratto della classe:

public static class DeviceInformation
{
/// <summary>
/// Gets device unique identifier or zero if device is an emulator
/// </summary>
public static uint UniqueId
{
get
{
byte[] data = (byte[])DeviceExtendedProperties.GetValue("DeviceUniqueId");
return BitConverter.ToUInt32(data, 0);
}
}
}

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

email it!bookmark it!digg it!

Original Post: [WP7] How to get Windows Phone Device unique identifier

Subscribe

New Feed

Product Spotlight

Recently Updated Sources

Legal Note

The content of the postings is owned by the respective author. Silverlight Feeds is not responsible for the contents of the postings. This site is automatically generated and cannot be reviewed for abusive content. If you find abusive content on Silverlight Feeds, please contact us. Designated trademarks and brands are the property of their respective owners. All rights reserved.

Advertise with us