I have a function similar to this:
private bool IsConnected()
{
if (DeviceInfo.DeviceType == DeviceType.Unknown)
return false;
var current = Connectivity.NetworkAccess;
if (current == NetworkAccess.Internet)
return true;
return false;
}
My teammates have reported zero issues with this function, and are using a variety of devices. My personal device is a Google Pixel 3, using Google Fi and Google VPN. When I cut it into airplane mode, I see Connectivity.NetworkAccess
is set to NetworkAccess.None
. However, when I leave airplane mode off and turn both Mobile Data and Wifi off explicitly, I see Connectivity.NetworkAccess
is set to NetworkAccess.Internet
.
Related to this, the Connectivity.ConnectionProfiles
reports a single profile: ConnectionProfile.Unknown
.
Is this expected behavior? Should I check a combination of Connectivity.ConnectionProfiles
as well as Connectivity.NetworkAccess
in attempting to determine if the device actually is connected to a network?