2016-09-29 29 views
0

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

我正在开发一个通用Windows应用程序,其中我想知道如何检测弱信号Internet强度,无论它可能是LAN,Wi-Fi,蜂窝数据,如何检测连接/信号强度是缓慢或非常差等。

是否有任何方法可以在通用Windows应用程序中知道这一点?

请让我知道提供的各种选项,通过它我可以做到这一点

请让我知道。

回答

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

如何检测程式设计在通用的Windows应用程序弱信号强度(互联网,无线网络,移动数据等)?

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

我怎样才能检测是否连接/信号强度缓慢或非常差等等。

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

官方示例Network information sample已完成关于您想要的功能的演示,您可以下载以进行测试。

相关问题