O'Reilly logo

Xamarin Mobile Application Development for iOS by Paul F. Johnson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Accessing the Internet

Access to the internet is via the UIWebView controller. Prior to trying to access an internet site, it's a good idea to ensure there is a live network connection. This is preformed via the NetworkReachability class.

using MonoTouch.SystemConfiguration;
NetworkReachability reach = new NetworkReachability("www.bbc.co.uk");
NetworkReachabilityFlags flags = new NetworkReachabilityFlags();
reach.TryGetFlags(out flags);
Console.WriteLine("Network flag = {0}", flags.ToString());

The WriteLine command will result in one of the following flags:

Flag

Value

Reachable

The host is reachable

IsWWAN

Connection is made through EDGE, 3G, or 4G

IsLocalDevice

Connection is made to the local device

ConnectionAutomatic

Connection ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required