Please take a moment to fill out the following (change to preview to check or place x in []):
This is a
[x] Bug
[ ] Feature Request
Which plugin does this impact:
[ ] Battery
[x] Connectivity
[ ] Contacts
[ ] DeviceInfo
[ ] ExternalMaps
[ ] Geolocator
[ ] Media
[ ] Permissions
[ ] Settings
[ ] Text To Speech
[ ] Vibrate
Other:
Version Number of Plugin: 2.1.2
Device Tested On: OnePlus One, LG G4
Simulator Tested On:
Expected Behavior
Connect to wifi network in your Android Wifi settings. Run app and exercise the IsConnected property. Change to a different wifi network and repeat. The IsConnected status should be correct.
Actual Behavior
Sometimes when you switch hosts in your wifi settings while running an app, your ConnectivityManager property in ConnectivityImplementation.cs will return an instance that has already been disposed (Handle == IntPtr.Zero). Then you get a false negative when you call IsConnected since it goes into the Exception handler.
Changing the ConnectivityManager property to this fixes the bug:
ConnectivityManager ConnectivityManager
{
get
{
if (_connectivityManager == null || _connectivityManager.Handle == IntPtr.Zero)
_connectivityManager = (ConnectivityManager)(Application.Context.GetSystemService(Context.ConnectivityService));
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.2 Device Tested On: OnePlus One, LG G4 Simulator Tested On:
Expected Behavior
Connect to wifi network in your Android Wifi settings. Run app and exercise the IsConnected property. Change to a different wifi network and repeat. The IsConnected status should be correct.
Actual Behavior
Sometimes when you switch hosts in your wifi settings while running an app, your ConnectivityManager property in ConnectivityImplementation.cs will return an instance that has already been disposed (Handle == IntPtr.Zero). Then you get a false negative when you call IsConnected since it goes into the Exception handler.
Changing the ConnectivityManager property to this fixes the bug: ConnectivityManager ConnectivityManager { get { if (_connectivityManager == null || _connectivityManager.Handle == IntPtr.Zero) _connectivityManager = (ConnectivityManager)(Application.Context.GetSystemService(Context.ConnectivityService));
Steps to reproduce the Behavior