locked
Device Unique Identifier in windows 8 metro apps RRS feed

  • Question

  • Hi,

    I am developing windows 8 metro apps, I want to get device unique Identifier.And is it possible to get the unique device identifier for phone also.

    How to get it using c# .Please help me.

    Thanks in advance.

    Regards

    Puneeth


    • Edited by puneethkv Thursday, September 19, 2013 5:11 AM
    Thursday, September 19, 2013 5:10 AM

Answers

All replies

  • Hello puneethkv,

    try this code: this is device id.

    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);
        }


    This is application id:

    string appId = CurrentApp.AppId.ToString();

    • Edited by Khant Nipun Thursday, September 19, 2013 6:10 AM
    Thursday, September 19, 2013 6:08 AM
  • Hi khant,

    Thanks for your reply..

    The code you posted  is unique to specific apps, not for device.

    Is there a way to get unique Id specific to device.

    Thanks

    Puneeth

    Thursday, September 19, 2013 6:33 AM
  • Hello puneethkv,

    Using EasClientDeviceinformation class you can get device id. Show link for briefly introduce of that class:

    http://msdn.microsoft.com/en-us/library/windows/apps/windows.security.exchangeactivesyncprovisioning.easclientdeviceinformation?cs-save-lang=1&cs-lang=csharp#code-snippet-1


    Thursday, September 19, 2013 6:49 AM
  • EasClientDeviceInformation Id is not unique.

    You can try to use Device Mac Address as your Unique ID.

    You can refer this to get the Mac Address

    http://msdn.microsoft.com/en-gb/library/windows/desktop/aa394216(v=vs.85).aspx

    • Edited by Shyam Sundar N Thursday, September 19, 2013 7:13 AM To Update the URL
    Thursday, September 19, 2013 7:10 AM
  • Check out this superub answer on Stack Overflow
    Thursday, September 19, 2013 8:56 AM
  • The correct answer is EasClientDeviceinformation.  There is no other device-specific ID for Windows RT, by design.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Tuesday, September 24, 2013 3:13 PM
    Moderator