Answered by:
How to get Device ID ??

Question
-
Hi ,
How can I get the Device Unique ID for my tablet surface ?
I found this
http://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.enumeration.deviceinformation.aspx
and also I have implemented the EnumerateDeviceContainers from Microsoft Sample.
string[] properties = { "System.ItemNameDisplay", "System.Devices.ModelName", "System.Devices.Connected" };
var containers = await PnpObject.FindAllAsync(PnpObjectType.DeviceContainer, properties);
foreach (PnpObject container in containers)
{
MyDisplayItems.Add(new DisplayItem(container));
}
and the Class
class DisplayItem
{
public DisplayItem(PnpObject container)
{
name = (string)container.Properties["System.ItemNameDisplay"];
if (name == null || name.Length == 0)
{
name = "*Unnamed*";
}
id = container.Id;
properties += "Property store count is: " + container.Properties.Count + "\n";
foreach (var prop in container.Properties)
{
properties += prop.Key + " := " + prop.Value + "\n";
}
}
public string Id { get { return id; } }
public string Name { get { return name; } }
public string Properties { get { return properties; } }
readonly string id;
readonly string name;
readonly string properties;
}Exactly like the example. But the MyDisplayItems[0].Id , the first Item of the collection Contains zeroes and FFs. The other Ids have numbers etc. How Can I get my tablet's device ID ? Am I doing something wrong ? Appreciate any help you could give me. Thank you
Wednesday, January 23, 2013 8:45 AM
Answers
-
there isnt such id available so far i know. you will have to generate one your self
Microsoft Certified Solutions Developer - Windows Store Apps Using C#
- Marked as answer by zakkar Wednesday, January 23, 2013 9:28 AM
Wednesday, January 23, 2013 8:47 AM
All replies
-
there isnt such id available so far i know. you will have to generate one your self
Microsoft Certified Solutions Developer - Windows Store Apps Using C#
- Marked as answer by zakkar Wednesday, January 23, 2013 9:28 AM
Wednesday, January 23, 2013 8:47 AM -
Hmm.
Should I use for example GUID ??
Wednesday, January 23, 2013 9:14 AM -
yes and save it in the isolatedstoeage
Microsoft Certified Solutions Developer - Windows Store Apps Using C#
Wednesday, January 23, 2013 9:16 AM -
OK.
If I use the MyDisplayItems[1].Id(refers to the USB massive storage) which has something, will it be unique ?
Wednesday, January 23, 2013 9:20 AM -
Check this out : HardwareIdentification.GetPackageSpecificToken. Not sure whether its always unique, just give it a try if needed.
- Ram
If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
- Edited by Ramprasath R Wednesday, January 23, 2013 10:41 AM
Wednesday, January 23, 2013 10:41 AM -
before jumping into conclusions, did you have a look at the HardwareIdentification class? It is supposed to provide (from MSDN link):
"Application Specific Hardware Identifier (ASHWID for short) in conjunction with its back-end service to implement per-device logic. Apps that employ per-device licensing policies are examples of apps that belong to this category. "
So something like:
var packageSpecificToken = Windows.System.Profile.HardwareIdentification.GetPackageSpecificToken(null); // hardware id, signature, certificate IBuffer objects // that can be accessed through properties. IBuffer hardwareId = packageSpecificToken.Id; IBuffer signature = packageSpecificToken.Signature; IBuffer certificate = packageSpecificToken.Certificate; var deviceID = BitConverter.ToString(hardwareId.ToArray());
would actually provide you a token for that specific device if you want to implement a per-device logic in your implementation.
But please correct me if I am wrong...
Can Bilgin
Blog Samples CompuSightWednesday, January 23, 2013 10:59 AM