【问题标题】:How to programatically detect a weak Internet signal strength (Internet, Wi-Fi,Cellular Data etc..) in Universal Windows Apps?如何以编程方式检测通用 Windows 应用程序中的弱 Internet 信号强度(Internet、Wi-Fi、蜂窝数据等)?
【发布时间】:2016-09-29 19:03:07
【问题描述】:

如何以编程方式检测通用 Windows 应用程序中的弱信号强度(互联网、Wi-Fi、移动数据等)??

我正在开发一个通用 Windows 应用程序,我想知道如何检测弱信号 Internet 强度是否可能是 LAN、Wi-fi、蜂窝数据,我如何检测连接/信号强度是否慢或者很差等等。

有什么方法可以让我在通用 Windows 应用程序中知道这一点?

请让我知道我可以实现的各种可用选项

请告诉我。

【问题讨论】:

    标签: uwp windows-10 windows-10-universal uwp-xaml


    【解决方案1】:
    foreach (ConnectionProfile profile in NetworkInformation.GetConnectionProfiles()) //Get all active profiles (LAN, bluetooth, wifi, Cellular data, etc..)
    {
       NetworkConnectivityLevel level = profile.GetNetworkConnectivityLevel(); //Get connectivity level for profile
       /*NetworkConnectivityLevel.InternetAccess         
                                  ConstrainedInternetAccess
                                  LocalAccess
                                  None*/
      Byte signal = profile.GetSignalBars(); //Returns the signal level
      bool isWifi = profile.IsWlanConnectionProfile;
      bool isCellularData = profile.IsWwanConnectionProfile;
    }
    

    【讨论】:

      【解决方案2】:

      如何以编程方式检测通用 Windows 应用程序中的弱信号强度(互联网、Wi-Fi、移动数据等)??

      正如@Stefano Balzarotti 所发布的,您可以使用NetworkInformation 类的GetConnectionProfiles 方法来获取连接配置文件列表。

      我如何检测连接/信号强度是否缓慢或非常差等。

      你可以从ConnectionProfile.GetSignalBars 方法的结果中得到信号强度。

      官方样例Network information sample已经完成了你想要的功能的demo,你可以下载测试一下。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2011-06-24
        • 2013-01-27
        • 2016-03-01
        • 2017-07-30
        相关资源
        最近更新 更多