title: Xamarin Android Location updates not being called
body: <p>I am trying to log location during an activity however I am not getting location updates. I have played around with the min refresh interval as well as the distance interval however it still doesn't work. I followed Xamarin's example for location updates but I've been banging my head against the wall as to why location updates arent working!</p>
  
  <pre><code>public class ActivityManager : Java.Lang.Object, ILocationListener, ISensorEventListener
  {
      private readonly LocationManager _locationManager;
      private readonly SensorManager _sensorManager;
  
      private readonly List&lt;Location&gt; _locationCache;
      private readonly List&lt;SensorEvent&gt; _sensorCache;
  
      private bool Continous { get; set; }
  
      public ActivityManager(LocationManager locationManager, SensorManager sensorManager)
      {
          _locationManager = locationManager;
          _sensorManager = sensorManager;
  
          _locationCache = new List&lt;Location&gt;();
          _sensorCache = new List&lt;SensorEvent&gt;();
  
          Continous = false;
      }
  
      public void StartTrackingLocation()
      {
          const string provider = LocationManager.GpsProvider;
  
          if (_locationManager.IsProviderEnabled(provider))
          {
              _locationManager.RequestLocationUpdates(provider, 0, 0, this);
          }
      }
  
      public void StartTrackingAccelerometer()
      {
          var mHandlerThread = new HandlerThread("sensorThread");
          mHandlerThread.Start();
          var handler = new Handler(mHandlerThread.Looper);
          _sensorManager.RegisterListener(this, _sensorManager.GetDefaultSensor(SensorType.Accelerometer),
              SensorDelay.Normal, handler);
      }
  
      public void StopTrackingLocation()
      {
          _locationManager.RemoveUpdates(this);
      }
  
      public void StopTrackingAccelerometer()
      {
          _sensorManager.UnregisterListener(this);
      }
  
      public void StartContinousTracking()
      {
          _locationCache.Clear();
          _sensorCache.Clear();
  
          Continous = true;
      }
  
      public void StopContinousTracking()
      {
          _locationCache.Clear();
          _sensorCache.Clear();
  
          Continous = false;
      }
  
      public void ExportLocationData(string path)
      {
          var kml = new Kml
          {
              Feature = new Placemark
              {
                  Geometry = new LineString
                  {
                      Coordinates = new CoordinateCollection(_locationCache.Select(l =&gt; new Vector {Latitude = l.Latitude, Longitude = l.Longitude}))
                  }
              }
          };
  
          var kmlFile = KmlFile.Create(kml, true);
  
          using (var stream = File.OpenWrite(path))
          {
              kmlFile.Save(stream);
          }
      }
  
      public void ExportSensorData(string path)
      {
          var csv = new CsvWriter(new StreamWriter(path));
  
          csv.WriteField("AccX");
          csv.WriteField("AccY");
          csv.WriteField("AccZ");
          csv.NextRecord();
  
          foreach (var s in _sensorCache.ToList())
          {
              csv.WriteField(s.Values[0]);
              csv.WriteField(s.Values[1]);
              csv.WriteField(s.Values[2]);
              csv.NextRecord();
          }
  
          csv.Dispose();
      }
  
      public void OnLocationChanged(Location location)
      {
          _locationCache.Add(location);
          if (!Continous) _locationCache.RemoveAll(l =&gt; location.Time - l.Time &gt; 120000);
      }
  
      public void OnSensorChanged(SensorEvent e)
      {
          _sensorCache.Add(e);
          if (!Continous) _sensorCache.RemoveAll(s =&gt; e.Timestamp - s.Timestamp &gt; 120000000000);
      }
  
      public void OnProviderDisabled(string provider) { }
  
      public void OnProviderEnabled(string provider) { }
  
      public void OnStatusChanged(string provider, Availability status, Bundle extras) { }
  
      public void OnAccuracyChanged(Sensor sensor, SensorStatus accuracy) { }
  }
  </code></pre>
  
  <p>Thanks in advance.</p>