Git Product home page Git Product logo

connectivityplugin's Introduction

Connectivity Plugin for Xamarin and Windows

Simple cross platform plugin to check connection status of mobile device, gather connection type, bandwidths, and more.

Documentation

Get started by reading through the Connectivity Plugin documentation.

NuGet

Build:

I have been working on Plugins for Xamarin for a long time now. Through the years I have always wanted to create a single, optimized, and official package from the Xamarin team at Microsoft that could easily be consumed by any application. The time is now with Xamarin.Essentials, which offers over 50 cross-platform native APIs in a single optimized package. I worked on this new library with an amazing team of developers and I highly highly highly recommend you check it out.

Additionally, Xamarin.Essentials is now included in & .NET MAUI.

Due to the functionality being included "in the box" I have decided to officially archive this repo.

Platform Support

Platform Version
Xamarin.iOS iOS 6+
tvOS - Apple TV All
Xamarin.Android API 10+
Windows 10 UWP 10+
Xamarin.Mac All
.NET 4.5/WPF All
.NET Core 2.0+
Tizen 4.0+

Created By: @JamesMontemagno

Contribution

Thank you for your interest in contributing to the Connectivity plugin! In this section we'll outline what you need to know about contributing and how to get started.

Bug Fixes

Please browse open issues, if you're looking to fix something, it's possible that someone already reported it. Additionally you select any up-for-grabs items

Pull requests

Please fill out the pull request template when you send one. Run tests to make sure your changes don't break any unit tests. Follow these instructions to run tests -

iOS

  • Navigate to tests/Connectivity.Tests.iOS
  • Execute make run-simulator-tests

Android

Execute ./build.sh --target RunDroidTests from the project root

License

The MIT License (MIT) see License file

Want To Support This Project?

All I have ever asked is to be active by submitting bugs, features, and sending those pull requests down! Want to go further? Make sure to subscribe to my weekly development podcast Merge Conflict, where I talk all about awesome Xamarin goodies and you can optionally support the show by becoming a supporter on Patreon.

connectivityplugin's People

Contributors

azureadvocatebit avatar bigadz avatar cecilcable avatar dominiquesavoie avatar f1nzer avatar fabienmw avatar froggiefrog avatar jamesmontemagno avatar jongheonchoi avatar k232 avatar koseng avatar mihamarkic avatar prashantvc avatar sourceclimber avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

connectivityplugin's Issues

Support for .NETStandard?

Ist it possible to support .NetStandard? It is written everywhere to use .NetStandard instead of PCLs, but this plugin is not compatible (yet).

Package Manager console:
Package Xam.Plugin.Connectivity 2.2.12 is not compatible with netstandard1.4 (.NETStandard,Version=v1.4). Package Xam.Plugin.Connectivity 2.2.12 supports:

  • monoandroid10 (MonoAndroid,Version=v1.0)
  • monotouch10 (MonoTouch,Version=v1.0)
  • net45 (.NETFramework,Version=v4.5)
  • portable-monoandroid10+monotouch10+net45+uap10+win8+wp8+wp81+wpa81+xamarinios10+xamarinmac20 (.NETPortable,Version=v0.0,Profile=net45+wp80+wp81+wpa81+win8+MonoAndroid10+MonoTouch10+Xamarin.iOS10+Xamarin.Mac20+UAP10)
  • uap10 (UAP,Version=v1.0)
  • win8 (Windows,Version=v8.0)
  • wp8 (WindowsPhone,Version=v8.0)
  • wp81 (WindowsPhone,Version=v8.1)
  • wpa81 (WindowsPhoneApp,Version=v8.1)
  • xamarinios10 (Xamarin.iOS,Version=v1.0)

See: https://blogs.msdn.microsoft.com/dotnet/2016/09/26/introducing-net-standard/ (section: As a library author, what should I do now?)

IsConnected returns always true when we use vpn

Bug

I have notice that in the latest version i always get true, even without sim card and wifi off, even on airplane mode. If i disable the vpn it works as expected. This was not happening on the previous version. Im using the app block this! That stop ads though vpn.

Version Number of Plugin: latest stable
Device Tested On: Samsung galasy s3 neo

Steps to reproduce the Behavior

Use a vpn and check what IsConnected returns

ConnectivityChanged isn't fired when changing from cellular to WiFi

Bug

A bug exists whnever you enable WIFI over Cellular and ConnectivityChanged never fires/
you can download the solution i attached and test it on android

Version Number of Plugin: Latest Version 2.2.12
Device Tested On: Samsung Galaxy S7 Edge
Simulator Tested On:

Expected Behavior

ConnectivityChanged event should be fired whenever connectivity changes

Actual Behavior

ConnectivityChanged event only fires from no connectivity to when connectivity is available however it never fires when connectivity changes from cellular to WiFi

Steps to reproduce the Behavior

1- run the solution attached
2- enable cellular
3- enable wifi

Feature Request:

ConnectivityChanged event needs to raise whenever there is a change in connectivity from any type to any type

[UWP] Virual Connections -> IsConnected Always returns True

CrossConnectivity.Current.IsConnected always returns True on UWP, but works great on Android. Disabling a couple connected VEthernet connections for my phone emulators fixed the problem. Not sure if support can be added for these virtual connections or not.

Bug

Version Number of Plugin: 2.2.12 and 2.2.40 Beta
Device Tested On: UWP
Simulator Tested On:

Require Remote Connectivity

Copied from: jamesmontemagno/Xamarin.Plugins#299

Feature Request:

It would be nice to do more than manually check if a remote host is reachable. The plugin should have a mechanism to require a remote host is reachable and in the event that the host is not reachable a ConnectivityChanged event or possibly a new event should be triggered. This would be helpful particularly for Enterprise Applications which may require connectivity to a private Api and the device may experience loss of connectivity to that host while still being connected to the internet.

Project fails on physical device when updating Connectivity

Copied from: jamesmontemagno/Xamarin.Plugins#291

Bug

Version Number of Plugin: 2.1.2.0
Device Tested On: Lumia 925 WinPhone 8.1 (Issue present)
Simulator Tested On: WinPhone 8.1 , WinMobile 10 (Issue NOT present)

Expected Behavior

The App should start normally, Connectivity plugin should be initialized

Actual Behavior

The App crashes on start (Connectivity is initialized in App class constructor)
Enabling 'break on every exception' via Exception Settings of the IDE, I can extract the real exception

Exception thrown: 'System.IO.FileLoadException' in MyApp.Mobile.WinPhone.ni.EXE
Additional information: Could not load file or assembly 'Plugin.Connectivity.Abstractions,
Version=2.1.2.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Steps to reproduce the Behavior

  • Install or update package in your solution to 2.1.2.0
  • Deploy to a physical WinPhone 8.1 devce (on simulators issue doesn't occur)

Error: Could not resolve type with token 01000022

Bug

Could not resolve type with token 01000022 is being thrown while calling: CrossConnectivity.Current.ConnectivityChanged += ConnectivityChanged;

Version Number of Plugin: 2.3.0
Device Tested On: LG G3 Android 4.4.2
Simulator Tested On: Genymotion

Expected Behavior

Should attach the event handler

Actual Behavior

Could not resolve type with token 01000022

at Plugin.Connectivity.ConnectivityChangeBroadcastReceiver.get_IsConnected () [0x00000] in C:\projects\connectivityplugin\src\Connectivity.Plugin.Android\ConnectivityChangeBroadcastReceiver.cs:51
at Plugin.Connectivity.ConnectivityChangeBroadcastReceiver..ctor () [0x00006] in C:\projects\connectivityplugin\src\Connectivity.Plugin.Android\ConnectivityChangeBroadcastReceiver.cs:34
at Plugin.Connectivity.ConnectivityImplementation.remove_ConnectivityTypeChanged (Plugin.Connectivity.Abstractions.ConnectivityTypeChangedEventHandler value) [0x0002a] in C:\projects\connectivityplugin\src\Connectivity.Plugin.Android\ConnectivityImplementation.cs:29
at Plugin.Connectivity.CrossConnectivity.CreateConnectivity () [0x00000] in C:\projects\connectivityplugin\src\Connectivity.Plugin\CrossConnectivity.cs:34
at Plugin.Connectivity.CrossConnectivity+<>c.<.cctor>b__7_0 () [0x00000] in C:\projects\connectivityplugin\src\Connectivity.Plugin\CrossConnectivity.cs:11
at System.Lazy`1[T].CreateValue () [0x00075] in /Users/builder/data/lanes/4009/3d959b66/source/mono/mcs/class/referencesource/mscorlib/system/Lazy.cs:437

Steps to reproduce the Behavior

I still cannot isolate the issue, it works on some computers. Any hint on things to try would be great. Although read the source line where the exception is being thrown I still can't figure it out.

EDIT: so far it seems to happen on Xamarin Studio or Visual Studio for Mac and not on Visual Studio for Windows.

Thanks!

ConnectivityChanged doesn't fire

Bug

Version Number of Plugin: 2.2.12
Device Tested On: iPhone 6 (iOS 9.3.2)
Simulator Tested On: NO

Expected Behavior

ConnectionChanged delegated is fired when I make iPhone online/off-line.

Actual Behavior

ConnectionChanged is not called, and CrossConnectivity.Current.IsConnected is always true if call manually.

Run is Crash

Please fill out either the bug or feature request section and remove whatever section you are not using.

Bug

Version Number of Plugin: 2.3.
Device Tested On:iPhone Simulator
Simulator Tested On:current plugin

Expected Behavior

Actual Behavior

Steps to reproduce the Behavior

Feature Request:

Please fill in what you would like

error:System.NotImplementedException: This functionality is not implemented in the portable version of this assembly. You should reference the NuGet package from your main application project in order to reference the platform-specific implementation.

Strange behavior on iOS when running the sample

Please fill out either the bug or feature request section and remove whatever section you are not using.

Bug

Version Number of Plugin: 2.2.2 (download of code from today)
Device Tested On: iPhone 4
Simulator Tested On: iPhone 6s

Expected Behavior

Run the sample, click connectivity test and all default hosts should be 'Reachable'.

Actual Behavior

iPhone 4 connected to IPv6 network: Both results come up as 'Not Reachable'
iPhone 6s simulator connected to IPv4 network: First result is 'Not Reachable' and second is 'Reachable'
Android 5.1 simulator: Both results come up as 'Reachable'

Steps to reproduce the Behavior

Run the sample, tap 'Connectivity Test' and look at the results.

Add "IsActive" to connection type

Copied from: jamesmontemagno/Xamarin.Plugins#255

Feature Request:

ConnectionTypes returns a list of active connections, but it would be nice to know which connection is being used for network calls... I'm not sure about other platforms, but for Windows you can get the connection that's being used by calling NetworkInformation.GetInternetConnectionProfile();

Can you either order the ConnectionTypes so that the first item is the connection being used or maybe add a new property... I guess this request could get tricky if Android and iOS don't support finding the connection being used.

TFS character limit reached due obscenely long folder name.

Feature Request: rename a folder in the project.

we are seeing a 95 character folder name in the connectivity plugin. can this name please be shortened as it is causing issues with our legacy project and TFS' 259 character limitations.

portable-net45+wp80+wp81+wpa81+win8+MonoAndroid10+MonoTouch10+Xamarin.iOS10+Xamarin.Mac20+UAP10 is the folder name in question.

Could it be shortened some?

Trigger ConnectivityChanged Event every time the ConnectionTypes change

Feature Request:

The ConnectivityChanged event should be triggert every time the Connection Type changes.
E.g. if i am in a Cellular Network and switch to a WiFi network, i would like to get notified that the connection type changed.

Because the IsConnected status does not change when switching from one ConnectionType to another, the event is not triggert. This could be enabled by removing the check if the previous connection status is the same as the new connection status, for example:

  • On Android in ConnectivityChangeBroadcastReceiver.cs line 78.
  • On iOS in ConnectivityImplementation.cs on line 50.

Another possibility would be to introduce a ConnectionTypeChanged event.

Method 'IsReachable' not found in type 'Plugin.Connectivity.Abstractions.IConnectivity'.

Bug

When running a Xamarin.Forms app on Android, the IsReachable method cannot be found.
Attempting the following scenario with IsRemoteReachable yields the same results.

Version Number of Plugin: 2.2.12 & 2.3.0.37-beta
Device Tested On: None
Simulator Tested On: KitKat (API Level 19, OS 4.4) on Windows

Expected Behaviour

IsReachable returns true or false depending on if the host can be accessed

Actual Behaviour

The code executing IsReachable is skipped. Accessing CrossConnectivity.Current.IsReachable() from the Immediate Window in Visual Studio gives the error message reported in the title.

Steps to reproduce the Behaviour

Create a new Xamarin.Forms app, set the API level to 19 and implement the IsReachable() method.

System.NotImplementedException

CrossConnectivity.Current.IsConnected get 'System.NotImplementedException' in Plugin.Connectivity.DLL on every platforms

var IsNetworkReachable = CrossConnectivity.Current.IsConnected;

Version Number of Plugin: 2.2.12.0
Device Tested On:
Simulator Tested On: Android, Windows 10 Mobile, Windows 10

IsConnected returning false when on 3G Network (4G untested) iOS 10.0

I have a live app on the App Store that has recently been updated with the latest version of Xamarin and Xcode 8 iOS 10.0 etc. It uses the latest version of your ConnectivityPlugin. If I'm on a 3G Network on an iOS 9 device the connectivity plugin works as expected.

However on an iPhone 6 test device we have, if it is connected to 3G network it returns false for isConnected.

Changing wifi-networks doesn't trigger change event

Copied from: jamesmontemagno/Xamarin.Plugins#310

Bug

Version Number of Plugin:
Device Tested On:
Simulator Tested On:

Expected Behavior

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.

Steps to reproduce the 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.

Also to test:
Deploy a test application to a real device without any connection.
Activate cellular connection => event fired
Activate wifi connection => event not fired (but if we check the ConnectionTypes, Cellular has been replaced by Wifi)
Desactivate wifi connection => event not fired (but if we check the ConnectionTypes Wifi has been replaced by Cellular)
Desactivate cellular connection => event fired

Possible fix:

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));

            return _connectivityManager;
        }
    }

Works on Android but not iOS debugger/simulator

Please fill out either the bug or feature request section and remove whatever section you are not using.

Bug

Version Number of Plugin: 2.2.12
Device Tested On: Samsung Galaxy Note 5
Simulator Tested On: iOS, multiple simulated devices

Expected Behavior

In iOS debugger:
bool online = await CrossConnectivity.Current.IsRemoteReachable("google.com");

returns true when the simulator is connected to the Internet. Not tested on physical Apple device. Android works correctly.

Actual Behavior

In iOS debugger:
bool online = await CrossConnectivity.Current.IsRemoteReachable("google.com");

returns false when the simulator is connected to Internet.

Steps to reproduce the Behavior

bool online = await Plugin.Connectivity.CrossConnectivity.Current.IsRemoteReachable("google.com");

Feature Request:

Please fill in what you would like

IsConnected returns true even with mobile data and wifi turned off

Bug

Xamarin.Forms with Android.
I turned WiFi and mobile data off. CrossConnectivity.Current.IsConnected still returns true. Airplane mode works -> IsConnected returns false.

Version Number of Plugin: 2.3.0
Device Tested On: Samsung Galaxy S7 Edge (Android 6.0.1)

Expected Behavior

CrossConnectivity.Current.IsConnected returns false.

Actual Behavior

CrossConnectivity.Current.IsConnected returns true.

[Feature request] List of avalible WiFi, BT

Feature Request:

Get a list of WiFi AP's available. (including MAC, NAME, SSID, BSSID, strength etc. what is available)
Get a list of BT devices available. (including MAC, NAME, Id's etc. what is available)

To be used for location, eg. are you Home/Office etc. What room you in and more.

CrossConnectivity.Current.IsReachable always returns False on Android device

Please fill out either the bug or feature request section and remove whatever section you are not using.

Bug

statement = await CrossConnectivity.Current.IsReachable("http://www.google.com",5000);
always returns false on android side, iOS wise it's working perfectly. I tried with just google.com and www.google.com and any URL format that was coming into my head, nothing helped.

Version Number of Plugin: 2.2.12
Device Tested On: Samsung GT-P5210
Simulator Tested On:

Expected Behavior

Returns true because my device can access google.com

Actual Behavior

Returns false

Steps to reproduce the Behavior

Use it in PCL and try it on android device

Feature Request:

Please fill in what you would like
To be working I guess !

Problem to publish App Store - ipv6 rejected

Hi James,
I'm trying to publish to app store but it still rejecting my bynaries.

However, we continue to encounter one or more bugs in your app when reviewed on iPhone running iOS 9.3.5 on Wi-Fi connected to an IPv6 network.

I'm using HttpClient to connect to my Api hosted on azure, the ip is like https://blabla.azurewebsites.net
What can I do to get apple's aprove?

Thanks.

I'm using the last version from plugin

On iOS - CrossConnectivity.Current.ConnectivityChanged eventarg => always return True for "IsConnected"

I am using this connectivity plugin to check Internet connectivity for Xamarin Forms. I was tested connectivity change event using my iPad [iOS9] and it is always return true for IsConnected when I do on or off WIFI from Device.

I am reporting it as Bug.

Version Number of Plugin: 2.2.12
Device Tested On: iPad - IOS 9.3
Simulator Tested On: NIL

Code Snippet - I have added this code in constructor of

CrossConnectivity.Current.ConnectivityChanged += (sender, args) =>
                {
                    DisplayAlert("Connectivity Changed", "IsConnected: " + args.IsConnected.ToString(), "OK");
                };

Actual Behavior

I am using this connectivity plugin to check Internet connectivity for Xamarin Forms. I was tested connectivity change event using my iPad [iOS9] and it is always return true for IsConnected when I do on or off WIFI from Device.

Expected Behavior

I should get correct status from flag "IsConnected" when I do on or off my WiFi.

IsRemoteReachable returns true when there is no internet connection

Copied from: jamesmontemagno/Xamarin.Plugins#314

Bug

Version Number of Plugin:
Device Tested On:
Simulator Tested On:

Expected Behavior

Connect to wifi with internet connection
Launch application
await CrossConnectivity.Current.IsRemoteReachable("google.com") is true
reconnect to wifi without internet connection
open application
await CrossConnectivity.Current.IsRemoteReachable("google.com") is false

Actual Behavior

Connect to wifi with internet connection
Launch application
await CrossConnectivity.Current.IsRemoteReachable("google.com") is true
reconnect to wifi without internet connection
open application
await CrossConnectivity.Current.IsRemoteReachable("google.com") is true

I've made short investigation and found this http://stackoverflow.com/questions/16895819/wp8-socket-connectasync-completed-handler-always-returns-success. It's strange because documentation(https://msdn.microsoft.com/ru-ru/library/bb538102(v=vs.110).aspx) says that: If you are using a connection-oriented protocol, the ConnectAsync method starts an asynchronous request for a connection to the remote host, I understood that for tcp ConnectAsync should wait for successful handshake... but anyway I will try advice from stack overflow.
Any ideas about it?

IPv6 app store rejection

Bug

We are getting app store rejections saying our app isn't IPv6 compatible. I see in the reachability sample on xamarin that they are using this line

adHocWiFiNetworkReachability = new NetworkReachability (ipAddress.MapToIPv6 ());

https://github.com/xamarin/ios-samples/blob/228de75dabe7071b1e56a66856e616e61944e368/ReachabilitySample/reachability.cs#L67

and

https://github.com/xamarin/ios-samples/blob/228de75dabe7071b1e56a66856e616e61944e368/ReachabilitySample/reachability.cs#L81

Which this plugin doesn't. Could this be causing the issues?

Version Number of Plugin: 2.2.12
Device Tested On: iPhone 6s
Simulator Tested On: iPhone 6s

CrossConnectivity.Current.IsReachable & CrossConnectivity.Current.IsConnected always return false on Android

Please fill out either the bug or feature request section and remove whatever section you are not using.

Bug

Well, I don't know if this is a bug or if I don't know how to use it correctly!
I am not using Xamarin.Forms.
I have a PCL solution which contains xamarin.android solution inside it.
I have installed Xam.Plugin.Connectivity using Nuget only in my PCL.
In my PCL class, I am using:
public static async Task IsAPIReachable()
{
try
{
return await CrossConnectivity.Current.IsReachable("www.google.com");
}
catch
{
return false;
}
}

And in my Android I am calling this method:
if (await MYPCL.PCLClass.IsAPIReachable())
{
//Show YES
}
else
{
//Show NO
}

I am always getting NO

I have tried also CrossConnectivity.Current.IsRemoteReachable("google.com") and I am getting false.
And when I tried CrossConnectivity.Current.IsConnected also I am getting false.

Version Number of Plugin: 2.3.0
Device Tested On: Sony Xperia Z3
Simulator Tested On: all visual studio simulators

Expected Behavior

Return true because I can access internet on my Android device

Actual Behavior

Return false value

Steps to reproduce the Behavior

Feature Request:

Please fill in what you would like
Getting true value

On iPad - CrossConnectivity.Current.ConnectivityChanged eventarg => always return True for "IsConnected" when wifi changes

Bug

On iPad - CrossConnectivity.Current.ConnectivityChanged eventarg => always return True for "IsConnected"

testing for a story where the app sees connection being dropped and restored and displays indicator in application. we are using this plugin. on iOS running on iPhone and on Android devices it seems to work great. But when being tested on an iPad device that has no sim (cell data not set up) and connected by wifi.

If we pull up control panel and turn ON airplane mode it works.
If we pull up control panel and turn OFF wifi status it does call the ConnectivityChanged event handler set up but the IsConnected value is true even when we turned off the wifi.

Version Number of Plugin: 2.3.1.55-beta
Device Tested On: iPad running 10.2.1

Expected Behavior

the IsConnected to reflect having connection or not

Actual Behavior

the IsConnected is true when turning off wifi

Steps to reproduce the Behavior

  • setup ConnectivityChanged event handler
  • run app
  • swipe up and turn off wifi
  • event handler runs and value for IsConnected passed in is true, when expected to be false.

Code snippets

in App.xaml.cs
in the App constructor:
_connectivity = SimpleIoc.Default.GetInstance<IConnectivity>(); _connectivity.ConnectivityChanged += _connectivity_ConnectivityChanged;

Handler
private async void _connectivity_ConnectivityChanged(object sender, ConnectivityChangedEventArgs e) { if (!e.IsConnected) { ...some code when losing connection it never gets called if turning off wifi ...BUT does if turn on airplane mode } }

additional info

if I do the following:
var types = _connectivity.ConnectionTypes;
in the event handler, there is one value returned in types and it is a "Plugin.Connectivity.Abstractions.ConnectionType.Cellular"

so the plugin seems to see a Cellular connection even though it is not setup on the iPad and no sim (that I know of in it-client device) so can't turn it "off"

Not implemented exception

Hi,

I have added this package to my xamarin forms project, a not implemented exception is thrown whenever I try accessing the plugin. e.g. bool connected = CrossConnectivity.Current.IsConnected;
I have added to the PCL project as well as the platform project for android.

IsConnected always reports true on iOS 10

Bug

IsConnected always reports true on iOS 10 device. Android devices appear to be working correctly

##Version Number of Plugin:
2.2.12

##Device Tested On:
iPhone 6

Expected Behavior

IsConnected should flip when wifi is turned off/on

Steps to reproduce the Behavior

Insert into AppDelgate.FinishedLaunching() or into the PCL App() ctor:

CrossConnectivity.Current.ConnectivityChanged += (sender, args) =>
{
Alert("Connectivity Changed", "IsConnected: " + args.IsConnected.ToString());
};

Android: ConnectionTypes doesn't contain all connections

Moved from: jamesmontemagno/Xamarin.Plugins#282

Bug

Version Number of Plugin:
Device Tested On:
Simulator Tested On:

Expected Behavior

When cellular connection is active AND wifi connection too, ConnectionTypes should contains the 2 types.
By default Android use wifi connection if the 2 are active so I don't really know if it's possible for you to know that but if you could it would be great !

Actual Behavior

Only Wifi is present in ConnectionTypes

Steps to reproduce the Behavior

Activate cellular and wifi connection on a device.

IsConnected failing on iOS simulator

I'm trying to do some testing in the iOS simulator (iPhone 5, 9.3) with the Network Link Conditioner on OSX El Capitan. The CrossConnectivity.Current.IsConnected is coming back as true even though I have the Network Link Conditioner set to 100% failure. Basically my app gets past the IsConnected test and tries to hit my endpoint and craps out which is what I'm trying to avoid.

Does it work on the simulators?

Anything I can do from my end to further diagnose where I might be going wrong? I've installed the plugin on all projects, iOS/Android/Shared and I'm accessing it from shared code.

Running Xam Studio 6.1.1

IsConnected is always false on iOS 10 when connected to a private Wi-Fi

On iOS 9 or older, IsConnected would return true when connected to a private Wi-Fi (no Internet) however with iOS 10 (gm seed) the value is always false. It appears the problem is when
if (!adHocWiFiNetworkReachability.TryGetFlags(out flags)) is called. No flags are set yet on iOS 9, this same call flags are set.

Are there any changes in iOS 10 for Wi-Fi permission?

IsRemoteReachable() does not work if a proxy is set.

For both Android and iOS, if the WIFI connection is configured using a proxy, the IsReachable() and IsRemoteReachable() calls always return false. UWP seemed to work ok.

Version Number of Plugin: 2.2.12
Device Tested On: iPhone 6 plus, iOS 9.3. Android: multiple versions (4.3, 5.0, 6.0)
Simulator Tested On:

Expected Behavior

Had hoped that the IsReachable() and IsRemoteReachable() would take into account any system proxy setting, and use that for establishing a connection to determine connectivity. Since our application will be used often with corporate users that have WIFI connections that need a proxy, we can't reliably use this plug-in to determine connectivity up front.

Actual Behavior

Calls to IsReachable() and IsRemoteReachable() will timeout and return false.

Steps to reproduce the Behavior

On an iOS or Android device, configure a connection that uses a proxy to the network. Verify that the proxy works by checking normal browser connectivity. Then attempt to use the Connectivity plugin.

Feature Request:

Am guessing that since no-one else has reported this, maybe no-one else cares about proxy environments. Would sure be nice to have this supported.

Thanks
Jeremy

Possible bug with Dual SIM devices

Bug

I am unable to reproduce this issue because I do not have a dual SIM device but we have been getting reports from customers running Android that they are getting No Connection messages on dual SIM devices. Has this plugin been tested with multiple SIM devices or are there any known issues with these devices?

ConnectivityTypeChanged not available on 2.2.12

Bug (incorrect usage?)

Version Number of Plugin: 2.2.12 (NuGet)
Device Tested On: Windows10 & Android

Expected Behavior

I want to use the mentioned event as below:
CrossConnectivity.Current.ConnectivityTypeChanged += OnConnectivityTypeChanged;

Actual Behavior

I can't use it!
The ConnectivityChanged is working, but the other is not.
The IDE says that Current does not have this event.

I've checked that this feature is implemented in the tag 2.2.12 so I think it should be available but i'm not sure.

Thanks!

Cellular not in the list of connections even though connected ?

Please fill out either the bug or feature request section and remove whatever section you are not using.

Bug

Version Number of Plugin: 2.3.0
Device Tested On: iPad Mini with WiFi and Cell
Simulator Tested On:

Expected Behavior

I expected that when I foreach through CrossConnectivity.Current.ConnectionTypes I would see both cell and WiFi but i only see cell.

Actual Behavior

I expected that when I foreach through CrossConnectivity.Current.ConnectionTypes I would see both cell and WiFi but i only see cell.

Steps to reproduce the Behavior

Feature Request:

Please fill in what you would like

ConnectivityChangeBroadcastReceiver thrown on 2.3.0-beta*

I've recently tried out the version 2.3.0 beta-7, you published, and got the following exception:

Java.Lang.ClassNotFoundException: Didn't find class "md546bf78c6c1ea5df684f3f928d8d05883.ConnectivityChangeBroadcastReceiver" on path: DexPathList[[zip file "/data/app/com.storeflix.droid-1/base.apk"],nativeLibraryDirectories=[/data/app/com.storeflix.droid-1/lib/arm64, /system/fake-libs64, /data/app/com.storeflix.droid-1/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]

I haven't tested it thorroghly, but found this issue in the Xamarin forum, that looks like the same error: https://forums.xamarin.com/discussion/79841/connectivity-plugin-noclassdef-exception-with-latest-android-version-nougat

Went back to 2.2.12 and it works again.
Tested on Samsung SM-T280 (API 22)

Regression: iOS only returns "other" for connection type

Please fill out either the bug or feature request section and remove whatever section you are not using.

Bug

Version Number of Plugin: 2.2.2
Device Tested On: iPhone 6 9.3
Simulator Tested On: iPhone simulator 9.3

Expected Behavior

Should return wifi if on wifi

Actual Behavior

Only returning other

Steps to reproduce the Behavior

Call out to Connection types

Android: ConnectivityChangedEventArgs.IsConnected and ConnectivityTypeChangedEventArgs.IsConnected not correct

Bug

Version Number of Plugin: 2.3.0
Device Tested On: Nexus 5.X (Android 7.1.1)
Simulator Tested On: none

Expected Behavior

ConnectivityChanged event should fire on every connectivity change and ConnectivityTypeChangedEventArgs.IsConnected should be correct.

Actual Behavior

ConnectivityChanged event is not always firing when connectivity changes and ConnectivityTypeChanged event is firing but its IsConnected value is sometimes wrong.

Steps to reproduce the Behavior

  1. Run test app on Nexus 5.X (Android 7.1.1)
  2. Ensure that LTE is on and WiFi is off (this isn't strictly necessary but makes the problem occur more frequently)
  3. "Start Listening" in the test app.
  4. Toggle Airplane mode on and off
  5. When registered for the ConnectivityChanged event it sometimes doesn't fire. When registered for the ConnectivityTypeChanged event the IsConnected value is sometimes wrong.

After doing some debugging and adding extra logic it seems that the old way of determining connectivity using ActiveNetworkInfo returns the correct value immediately after receiving the broadcast. The new way using GetAllNetworks/GetNetworkInfo sometimes returns "true" at first (when connectivity has been turned off) but if called again repeatedly it does eventually return "false" after a few tenths of a second.

I don't know if the fact that the GetAllNetworks/GetNetworkInfo doesn't return up to the second information like ActiveNetworkInfo does is is an Android issue or expected Android behavior.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.