How to check internet connectivity type in Universal Windows Platform

Viewed 14068

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

  1. Not Connected
  2. Connected via WLAN(WiFi)
  3. Connected via WWAN(Cellular Data)
  4. Connected to a metered network

in order to provide an option for downloading large size content. And also sense the significant network availability changes.

Currently, I'm only able to check whether internet connected or not using GetIsNetworkAvailable method of NetworkInterface class.

NetworkInterface.GetIsNetworkAvailable();
3 Answers

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

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