@Test public void stopLocationUpdatesShouldSetListenerToNullWhenListenerIsCurrentlySet() { LocationListener locationListener = Mockito.mock(LocationListener.class); androidGpsLocationClient.addLocationListener(locationListener); Assert.assertTrue(androidGpsLocationClient.getLocationListeners().size() > 0); androidGpsLocationClient.stopLocationUpdates(); Assert.assertEquals(0, androidGpsLocationClient.getLocationListeners().size()); androidGpsLocationClient.setLocationListener(locationListener); Assert.assertNotNull(androidGpsLocationClient.getLocationListener()); androidGpsLocationClient.stopLocationUpdates(); Assert.assertNull(androidGpsLocationClient.getLocationListener()); }
@Override public void stopLocationUpdates() { if (isMonitoringLocation()) { lastLocation = null; locationManager.removeUpdates(androidGpsLocationListener); for (LocationListener locationListener : getLocationListeners()) { locationManager.removeUpdates(locationListener); } clearLocationListeners(); } unregisterForGpsStoppedEvent(); }
AndroidGpsLocationClient extends BaseLocationClient { @Override public void stopLocationUpdates() { if (isMonitoringLocation()) { lastLocation = null; locationManager.removeUpdates(androidGpsLocationListener); for (LocationListener locationListener : getLocationListeners()) { locationManager.removeUpdates(locationListener); } clearLocationListeners(); } unregisterForGpsStoppedEvent(); } }
AndroidGpsLocationClient extends BaseLocationClient { @Override public void stopLocationUpdates() { if (isMonitoringLocation()) { lastLocation = null; locationManager.removeUpdates(androidGpsLocationListener); for (LocationListener locationListener : getLocationListeners()) { locationManager.removeUpdates(locationListener); } clearLocationListeners(); } unregisterForGpsStoppedEvent(); } AndroidGpsLocationClient(@NonNull Context context); }
AndroidGpsLocationClient extends BaseLocationClient { @Override public void stopLocationUpdates() { if (isMonitoringLocation()) { lastLocation = null; locationManager.removeUpdates(androidGpsLocationListener); for (LocationListener locationListener : getLocationListeners()) { locationManager.removeUpdates(locationListener); } clearLocationListeners(); } unregisterForGpsStoppedEvent(); } AndroidGpsLocationClient(@NonNull Context context); @Override void stopLocationUpdates(); @SuppressLint("MissingPermission") @Nullable @Override Location getLastLocation(); @Override void requestLocationUpdates(@NonNull LocationListener locationListener); @Override void setUpdateIntervals(long updateInterval, long fastestUpdateInterval); @NonNull @Override String getProvider(); @Override void close(); }
AndroidGpsLocationClient extends BaseLocationClient { @Override public void stopLocationUpdates() { if (isMonitoringLocation()) { lastLocation = null; locationManager.removeUpdates(androidGpsLocationListener); for (LocationListener locationListener : getLocationListeners()) { locationManager.removeUpdates(locationListener); } clearLocationListeners(); } unregisterForGpsStoppedEvent(); } AndroidGpsLocationClient(@NonNull Context context); @Override void stopLocationUpdates(); @SuppressLint("MissingPermission") @Nullable @Override Location getLastLocation(); @Override void requestLocationUpdates(@NonNull LocationListener locationListener); @Override void setUpdateIntervals(long updateInterval, long fastestUpdateInterval); @NonNull @Override String getProvider(); @Override void close();  }