Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
..
Failed to load latest commit information.
README.md reorganizing files into recipes folder Mar 7, 2018

README.md

id title brief sample sdk
5FB6747E-70A7-0410-2C5C-60870D775100
Detect if Network is Available
This recipe shows how to detect the type of network connection that is in use.
title url
Reachability Sample
/samples/ReachabilitySample

Recipe

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("http://google.com")) {
    // Put alternative content/message here
}
else
{
    // 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
{
       NotReachable,
       ReachableViaCarrierDataNetwork,
       ReachableViaWiFiNetwork
}