Windows Phone 8 网络信息 [英] Windows Phone 8 network information

查看:24
本文介绍了Windows Phone 8 网络信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试获取有关网络的一些信息,例如网络类型、网络状态、小区 ID、MCC、MNC、LAC、BID、NID、SID、信号强度、运营商名称.

I am trying to get some information about the network like Network type, Network status, Cell ID, MCC, MNC, LAC, BID, NID, SID, Signal strength, Operator name.

我现在唯一能得到的是移动运营商名称:

The only thing I can get now is the mobile operator name using:

  using Microsoft.Phone.Net.NetworkInformation;
  System.Text.StringBuilder sb = new System.Text.StringBuilder();            

  sb.Append("Mobile operator:  ");
  sb.AppendLine(DeviceNetworkInformation.CellularMobileOperator);

就像我可以得到 WiFi 可用,漫游可用,只是对或错.是否有任何解决方案可以获取其他一些信息,例如网络类型(例如 GSM - CDMA)?

Like that I can get if WiFi is available, roaming available, just true or false. Is there any solution to get some of the other information, network type for example if it's GSM - CDMA for example?

还要查找 wifi 网络列表、可用位置并获取列表.

Also looking for the wifi network list, spots available and get the list.

推荐答案

您只能获取当前连接的网络接口的信息,而不能获取任何其他热点或蜂窝塔或其信号强度的信息.您也无法强制手机更改连接.

You can only get information for the currently connected network interfaces, not any other hotspots or cellular towers or their signal strength. You can't force the phone to change the connections either.

可以判断您使用的是 GSM、CDMA 还是 WiFi,您的连接速度是多少,以及您是否在漫游.

You can tell if you're on GSM or CDMA or WiFi and at what speed you're connected, and whether you're roaming.

请参阅此页面MSDN,特别是这个 链接页面 了解可用的 API.

See this page on MSDN, and specifically this linked page for a walk-through of the available APIs.

您可以从 Microsoft.Phone.Net.NetworkInformation.NetworkType 获取网络类型 (GSM/CDMA/WiFi)(请参阅 此处).

You can get the Network type (GSM/CDMA/WiFi) from Microsoft.Phone.Net.NetworkInformation.NetworkType (see here).

获取NetworkInformation对象的代码片段是:

The code snippet to get the NetworkInformation objects is:

private void UpdateNetworkInterfaces()
{
    NetworkInterfaces.Clear();
    NetworkInterfaceList networkInterfaceList = new NetworkInterfaceList();
    foreach (NetworkInterfaceInfo networkInterfaceInfo in networkInterfaceList)
    {
        NetworkInterfaces.Add(networkInterfaceInfo.InterfaceName);
    }
}

这篇关于Windows Phone 8 网络信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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