How to check internet connectivity type in Universal Windows Platform

后端 未结 3 1643
醉话见心
醉话见心 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:58

    To find if the user has any network connection whatsoever (including one without internet) I use

    public bool ConnectedToNetwork()
    {
        return NetworkInformation.GetInternetConnectionProfile()?.NetworkAdapter != null;
    }
    

提交回复
热议问题