In the Xamarin plugin Connectivity (Xam.Plugin.Connectivity), there is an easy way from the PCL to detect network connectivity changes, like:
CrossConnectivity.Current.ConnectivityChanged += (sender, args) =>
{
page.DisplayAlert("Connectivity Changed", "IsConnected: " + args.IsConnected.ToString(), "OK");
};
The property IsConnected
is read only, so my question is:
Is there a way to manually / programmatically set IsConnected
to false or otherwise simulate a lost network connection?