Ejemplo n.º 1
0
        //read http://iosapi.xamarin.com/?link=T%3aSystemConfiguration.NetworkReachability

        private NetworkStatus CheckConnectivitiy()
        {
            reachability = new SystemConfiguration.NetworkReachability(IPAddress.Parse("0.0.0.0"));
            NetworkReachabilityFlags flags;
            bool reachable = reachability.TryGetFlags(out flags);
            reachability.SetNotification(NetworkChangeDelegate);
            reachability.Schedule(CFRunLoop.Current, CFRunLoop.ModeDefault);
            if (reachable)
                return NetworkStatusHelper(flags);
            else
                return NetworkStatus.NotReachable;
        }
Ejemplo n.º 2
0
 private bool IsNetworkAvailable(out NetworkReachabilityFlags flags)
 {
     if (defaultRouteReachability == null)
     {
         defaultRouteReachability = new NetworkReachability(new IPAddress(0));
         //    defaultRouteReachability.SetCallback(OnChange);
         defaultRouteReachability.Schedule(CFRunLoop.Current, CFRunLoop.ModeDefault);
     }
     if (!defaultRouteReachability.TryGetFlags(out flags))
     {
         return(false);
     }
     return(IsReachableWithoutRequiringConnection(flags));
 }
Ejemplo n.º 3
0
        //read http://iosapi.xamarin.com/?link=T%3aSystemConfiguration.NetworkReachability

        private NetworkStatus CheckConnectivitiy()
        {
            reachability = new SystemConfiguration.NetworkReachability(IPAddress.Parse("0.0.0.0"));
            NetworkReachabilityFlags flags;
            bool reachable = reachability.TryGetFlags(out flags);

            reachability.SetNotification(NetworkChangeDelegate);
            reachability.Schedule(CFRunLoop.Current, CFRunLoop.ModeDefault);
            if (reachable)
            {
                return(NetworkStatusHelper(flags));
            }
            else
            {
                return(NetworkStatus.NotReachable);
            }
        }