How to check internet connectivity type in Universal Windows Platform

后端 未结 3 1682
醉话见心
醉话见心 2021-01-30 09:26

I would like to check internet connectivity type in Windows Universal Application.

  1. Not Connected
  2. Connected via WLAN(WiFi)
  3. Connected via WWAN(C
3条回答
  •  轮回少年
    2021-01-30 09:57

    I use NetworkInformation.GetInternetConnectionProfile().IsWlanConnectionProfile and IsWwanConnectionProfile. If neither is true, it should mean you're on Ethernet or something like that.

    Keep in mind thatGetInternetConnectionProfile() can return null and can falsely return that there is an active internet connection when the connection is active but DHCP has failed.

提交回复
热议问题