Detect if Network is Available

PDF for offline use
Related Samples:
Related SDKs:

Let us know how you feel about this

Translation Quality


This recipe shows how to detect the type of network connection that is in use.


The Reachability sample provides a static class named Reachability that can be used to determine network status. Add a copy of this class to your project, and then use the static methods it provides.

  • To see if a web site is available you can check like this:
if(!Reachability.IsHostReachable("")) {
    // Put alternative content/message here
    // Put Internet Required Code here
  • To check what type of internet connection is available, use the static method Reachability.InternetConnectionStatus():
NetworkStatus internetStatus = Reachability.InternetConnectionStatus();

Reachability.InternetConnectionStatus returns the enum NetworkStatus which provides some information about the network connection that will be used for internet connectivity:

public enum NetworkStatus

Xamarin Workbook

If it's not already installed, install the Xamarin Workbooks app first. The workbook file should download automatically, but if it doesn't, just click to start the workbook download manually.