Hi everybody,
How can i check network connection? I found sample on github but its wrote mvvm pattern.
I wrote this code but. I've got object null exception.
My sample code is:
` private INetworkService _network { get; set; }
public WebAppPage(string targetUrl,string title)
{
Title = title;
// NavigationPage.SetHasNavigationBar(this, false);
ToolbarItems.Add(new ToolbarItem("Refresh","refresh.png", () =>
{
var reached = false;
reached = await _network.IsHostReachable("www.google.com");
if (!reached)
{
/ var result = await this.DisplayAlert("Sorry", "Check net connection", "Ok","");
return;
}
/ Debug.WriteLine("success: {0}", result);
})); `
Is anyone help me?
Thanks.