public static MvxReachabilityStatus RemoteHostStatus()
{
NetworkReachabilityFlags flags;
bool reachable;
if (remoteHostReachability == null)
{
remoteHostReachability = new NetworkReachability(DefaultHostName);
// Need to probe before we queue, or we wont get any meaningful values
// this only happens when you create NetworkReachability from a hostname
reachable = remoteHostReachability.TryGetFlags(out flags);
#warning Need to look at SetNotification instead - ios6 change
remoteHostReachability.SetNotification(OnChange);
remoteHostReachability.Schedule(CFRunLoop.Current, CFRunLoop.ModeDefault);
}
else
reachable = remoteHostReachability.TryGetFlags(out flags);
if (!reachable)
return MvxReachabilityStatus.Not;
if (!IsReachableWithoutRequiringConnection(flags))
return MvxReachabilityStatus.Not;
if ((flags & NetworkReachabilityFlags.IsWWAN) != 0)
return MvxReachabilityStatus.ViaCarrierDataNetwork;
return MvxReachabilityStatus.ViaWiFiNetwork;
}