Pratik
Pratik

Reputation: 720

CrossConnectivity.Current.ConnectivityChanged += HandleConnectivityChanged Not Working in Xamarin forms + UWP

hello I am working on Xamarin forms. I have use Xam.Plugins.Connectivity Package but When I m call

CrossConnectivity.Current.ConnectivityChanged += HandleConnectivityChanged

void HandleConnectivityChanged(object sender, ConnectivityChangedEventArgs e) { } 

It's Working in Android,ios,Windows phone device but it's not working UWP Desktop.

Please help me.

Upvotes: 1

Views: 593

Answers (1)

Nico Zhu
Nico Zhu

Reputation: 32785

I have tested your code and reproduced your issue. When I disconnected with Ethernet, the HandleConnectivityChanged method was not invoked.

enter image description here

And then I noticed that the network status icon displayed no internet access instead of Ethernet disconnection.

enter image description here

I checked the network connections and disable all the connections. The network state icon displayed no connection and the HandleConnectivityChanged was invoked.

enter image description here

So you could check if any other connection being displayed when you disable the connection.

Upvotes: 2

Related Questions