Closed Miresprig closed 8 years ago
Thanks for the info, will fix today in 2.1.2
For me the issue is still present in 2.1.2, testing on a physical device (Lumia 925 Win 8.1), as well as on emulators (8.1 and 10)
When in airplane mode, with all devices / OS above mentioned
IsConnected
always returns true
ConnectionTypes
contains Cellular
Bandwiths
contains an element with value 0
Moreover 2.1.2 seems to have a reference probing issue when deployed on a physical 8.1 device, for which the App doesn't start, and I'll create a separate issue
Massimo
Tested on physical devices again and incorrect behavior when in airplane mode doesn't occur anymore with version 2.2.12
I have this same issue using a Windows emulator. And a Nokia Lumina 830. Is connected is always true, even without an internet connection. I am going through some xamarin tutorials and have pulled in the latest Plugin.Connectivity 2.3 version. This is not fixed.
I should further explain that I am using the Nokia Lumina 830 as the hotspot for the internet connection. Disconnection on the Wifi or turning internet sharing off, does not change the CrossConnectivity.Current.IsConnected will always return true.
I don't check anything on this repo anymore please find the respective repo
Please take a moment to fill out the following (change to preview to check or place x in []):
This is a
Which plugin does this impact:
Version Number of Plugin: 2.1.1 Device Tested On: Surface Pro 4 with Xamarin.Forms UWP. Simulator Tested On:
Expected Behavior
When disabling the Wifi on a Surface Pro 4 Win10 it should state that IsConnected is false.
Actual Behavior
IsConnected returns true.
Steps to reproduce the Behavior
Disable wifi and run any code against CrossConnectivity.Current.IsConnected. Make sure that you have no active networks in the "Network and Sharing Center" in the control panel if you have other connection types.
It has to do with this line of code. isConnected = NetworkInformation.GetInternetConnectionProfile()?.GetNetworkConnectivityLevel() != NetworkConnectivityLevel.None;
If there is now internet connection NetworkInformation.GetInternetConnectionProfile() return NULL, and null != NetworkConnectivityLevel.None is always true :)
Code like this should be sufficient. public override bool IsConnected { get { var connectionProfile = NetworkInformation.GetInternetConnectionProfile(); if (connectionProfile == null) isConnected = false; else isConnected = connectionProfile.GetNetworkConnectivityLevel() != NetworkConnectivityLevel.None; return isConnected; } }
//Daniel