protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (_receiver != null)
         {
             Application.Context.UnregisterReceiver(_receiver);
             _receiver.Dispose();
             _receiver = null;
         }
     }
 }
        public Connectivity()
        {
            ConnectivityChangeBroadcastReceiver.OnChange = info => NetworkChanged(info);

            var context = Application.Context;
            var manager = context.GetSystemService(Context.ConnectivityService)
                          .JavaCast <ConnectivityManager>();

            NetworkChanged(manager.ActiveNetworkInfo, false);

            _receiver = new ConnectivityChangeBroadcastReceiver();
            context.RegisterReceiver(_receiver,
                                     new IntentFilter(ConnectivityManager.ConnectivityAction));
        }