How do I get a Unique Identifier for a Device within Windows 10 Universal?

后端 未结 5 772
盖世英雄少女心
盖世英雄少女心 2020-11-29 09:33

This is my old implementation to get a Unique DeviceID for Windows Universal 8.1 but the type HardwareIdentification does not exist anymore.

    private sta         


        
5条回答
  •  悲哀的现实
    2020-11-29 09:48

    Update for Windows 1609 ("Anniversary Update")

    See this Q&A for a much better way to get an ID.

    Old info for older OS builds

    You need to add a reference to the Desktop and / or Mobile SDKs to build against the Hardware Token. At runtime you should use the ApiInformation type to query if the API is present before using it (other device families like Xbox don't have it).

    That said, many times when people ask for the device ID that's not actually the best solution for their problem -- are you sure you need to identify the physical device across its entire lifespan, even if ownership changes?

提交回复
热议问题