视窗10 UWP - 检测如果当前的互联网连接WiFi或蜂窝?
问题描述:
在Windows 10 UWP应用程序如何检测如果当前的互联网连接WiFi或蜂窝?
In Windows 10 UWP app how do I detect if the current internet connection is Wifi or Cellular?
答
在UWP你。可使用IsWlanConnectionProfile或IsWwanConnectionProfile性能检查网络连接
In UWP you can check network connectivity using the IsWlanConnectionProfile or IsWwanConnectionProfile properties.
一个例子是:
var temp = Windows.Networking.Connectivity.NetworkInformation.GetInternetConnectionProfile();
if (temp.IsWlanConnectionProfile)
{
// its wireless
}else if (temp.IsWwanConnectionProfile)
{
// its mobile
}
我希望这有助于。