检索使用的WinRT一个设备的序列号 [英] Retrieving the serial number of a device using WinRT

查看:151
本文介绍了检索使用的WinRT一个设备的序列号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在一个应用程序,需要知道它正在运行的设备的序列号。该应用程序是为保险公司与用户能够直接获得保险装置。为保险政策需要的序列号。是否有可能检索设备的使用WinRT的,或可在Metro风格应用程序中使用任何API序列号?

We are working on an app that needs to know the serial number of the device it is running on. The app is for an insurance company with which the user is able to directly get insurance for the device. For the insurance policy the serial number is needed. Is it possible to retrieve the serial number of the device using the WinRT or any API that can be used in a metro style app?

推荐答案

我不知道这是否完全适合您的需求,但它是能够唯一标识设备(因为Windows 8 RTM)。

I do not know if it exactly fits your need, but it is possible to uniquely identify a device (since Windows 8 RTM).

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

这篇关于检索使用的WinRT一个设备的序列号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆