jamesmontemagno / Xamarin.Plugins

Cross-platform Native API Access from Shared Code!
MIT License
1.3k stars 380 forks source link

Xamarin cross platform project, bug in Whindows Phone Connectivity, IsConnected always true #228

Closed RiccardoRabino closed 8 years ago

RiccardoRabino commented 8 years ago

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:Windows phone Nokia Lumia 520 with WP 8.1 Update (in a Cross Platform project in Xamarin Simulator Tested On:

Expected Behavior

the boolean CrossConnectivity.Current.IsConnected has to return if there is a connection or not

the function CrossConnectivity.Current.IsRemoteReachable("google.com"); has to return a boolean if the site is reachable or not

Actual Behavior

the boolean CrossConnectivity.Current.IsConnected is always true, I tested with no SIM card, only wifi if the wifi is off the boolean is true, if the wifi is on and connected the boolean is true.

the function CrossConnectivity.Current.IsRemoteReachable("google.com") is Always false, tested as the other field, with wifi, I tried to reach the site and also when the site is reachable, with the browser the function return false

Steps to reproduce the Behavior

make a cross Platform project in Xamarin and call CrossConnectivity.Current.IsConnected with wifi on and wifi off

dimitrijevic commented 8 years ago

On a Lumia 620 with Windows 10 10586.107 NuGet version 2.1.1 also returns IsConnected true when device is in airplane mode. Version 2.0.2 works fine though...

Miresprig commented 8 years ago

It has to do with a IsConnected uses connection profiles. The code does not take into account that there are no profiles.

I had to fork the project and fix the IsConnected. Just created a new issue #244 that is the same as yours. Should have added the solution to your issue instead of cluttering the issues list.