Xamarin Forms – check if phone is currently connected to Internet or not

Sometimes, you may need to check if your application has internet connection or not. In order to do so, you can use the plugin
https://www.nuget.org/packages/Xam.Plugin.Connectivity/

and then using the following method:


public async Task HasInternet()
{
    var canReach = await CrossConnectivity.Current.IsRemoteReachable("google.com");
    return canReach;
}

About: tientham

Software Engineer, SW Integrator & Mobile , Full Stack Developer


Leave a Reply

Your email address will not be published. Required fields are marked *