zoukankan      html  css  js  c++  java
  • 获取Windows Phone设备信息

         在进行Windows Phone开发的过程中,我们会需要获取手机的一些相关信息,如下列出如何获取手机的一些常用信息。
      一.设备屏幕信息
        double width = Application.Current.Host.Content.ActualWidth;
        double heigth = Application.Current.Host.Content.ActualHeight;
      二.设备信息相关(Microsoft.Phone.Info)
        1.设备厂商
        string DeviceManufacturer = DeviceStatus.DeviceManufacturer;
        2.设备名称
        string DeviceName = DeviceStatus.DeviceName;
        3.设备ID
        byte[] result = null;
        object uniqueId;
        if (DeviceExtendedProperties.TryGetValue("DeviceUniqueId", out uniqueId))
        {
          result = (byte[])uniqueId;
        }
        //转换设备ID为字符串
        string DeviceUniqueId = Convert.ToBase64String(result);
        4.固件版本
        string DeviceFirmwareVersion = DeviceStatus.DeviceFirmwareVersion;
        5.硬件版本
        string DeviceHardwareVersion = DeviceStatus.DeviceHardwareVersion;
        6.总内存
        long DeviceTotalMemory = DeviceStatus.DeviceTotalMemory;
        7.应用程序当前使用内存
        long ApplicationCurrentMemoryUsage = DeviceStatus.ApplicationCurrentMemoryUsage;
        8.应用程序使用内存峰值
        long ApplicationPeakMemoryUsage = DeviceStatus.ApplicationPeakMemoryUsage;
        9.操作系统版本
        String osversion= System.Environment.OSVersion.Version.ToString();
      三.网络状态
        1. 获取网络是否可用
        bool flag = Microsoft.Phone.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable();
        2. 获取当前手机联网类型
        Microsoft.Phone.Net.NetworkInformation.NetworkInterface.NetworkInterfaceType
        Wireless80211是wifi
        None是没有网络连接
        MobileBroadbandGsm是gsm 2g网络连接
        MobileBroadbandCdma 是CDMA 联通3g
        Ethernet - 连接到电脑上网
        3. 获取当前是否开启网络连接
        bool flag = Microsoft.Phone.Net.NetworkInformation.DeviceNetworkInformation.IsNetworkAvailable;
        4. 获取是否开启wifi
        bool flag = Microsoft.Phone.Net.NetworkInformation.DeviceNetworkInformation.IsWiFiEnabled;

  • 相关阅读:
    wpf图片查看器,支持鼠标滚动缩放拖拽
    Python 3.x 学习笔记--杂
    Python 3.x 模块
    python 连接kafka
    Oracle问题
    Device Mapper Multipath(DM-Multipath)
    各种书籍
    Centos 6.x系统
    老男孩Python 3.x 讲义
    Python 3.x 学习笔记
  • 原文地址:https://www.cnblogs.com/qq278360339/p/2672130.html
Copyright © 2011-2022 走看看