@Test public void stopLocationUpdatesShouldSetListenerToNullWhenListenerIsCurrentlySet() { LocationListener locationListener = Mockito.mock(LocationListener.class); googleLocationClient.addLocationListener(locationListener); Assert.assertTrue(googleLocationClient.getLocationListeners().size() > 0); googleLocationClient.stopLocationUpdates(); Assert.assertEquals(0, googleLocationClient.getLocationListeners().size()); googleLocationClient.setLocationListener(locationListener); Assert.assertNotNull(googleLocationClient.getLocationListener()); googleLocationClient.stopLocationUpdates(); Assert.assertNull(googleLocationClient.getLocationListener()); }
@Override public void stopLocationUpdates() { if (isMonitoringLocation()) { lastLocation = null; clearLocationListeners(); fusedLocationClient.removeLocationUpdates(googleLocationCallback); } unregisterForGpsStoppedEvent(); }
GoogleLocationClient extends BaseLocationClient implements LocationListener { @Override public void stopLocationUpdates() { if (isMonitoringLocation()) { lastLocation = null; clearLocationListeners(); fusedLocationClient.removeLocationUpdates(googleLocationCallback); } unregisterForGpsStoppedEvent(); } }
GoogleLocationClient extends BaseLocationClient implements LocationListener { @Override public void stopLocationUpdates() { if (isMonitoringLocation()) { lastLocation = null; clearLocationListeners(); fusedLocationClient.removeLocationUpdates(googleLocationCallback); } unregisterForGpsStoppedEvent(); } GoogleLocationClient(@NonNull Context context); }
GoogleLocationClient extends BaseLocationClient implements LocationListener { @Override public void stopLocationUpdates() { if (isMonitoringLocation()) { lastLocation = null; clearLocationListeners(); fusedLocationClient.removeLocationUpdates(googleLocationCallback); } unregisterForGpsStoppedEvent(); } GoogleLocationClient(@NonNull Context context); @Override void stopLocationUpdates(); @Override @Nullable Location getLastLocation(); @Override void onLocationChanged(Location location); @Override void requestLocationUpdates(@NonNull android.location.LocationListener locationListener); void requestLocationUpdates(@NonNull android.location.LocationListener locationListener
            , @NonNull LocationRequest locationRequest); @Override void setUpdateIntervals(long updateInterval, long fastestUpdateInterval); @NonNull @Override String getProvider(); @Override boolean isProviderEnabled(); @Override void close(); FusedLocationProviderClient getFusedLocationClient(); }
GoogleLocationClient extends BaseLocationClient implements LocationListener { @Override public void stopLocationUpdates() { if (isMonitoringLocation()) { lastLocation = null; clearLocationListeners(); fusedLocationClient.removeLocationUpdates(googleLocationCallback); } unregisterForGpsStoppedEvent(); } GoogleLocationClient(@NonNull Context context); @Override void stopLocationUpdates(); @Override @Nullable Location getLastLocation(); @Override void onLocationChanged(Location location); @Override void requestLocationUpdates(@NonNull android.location.LocationListener locationListener); void requestLocationUpdates(@NonNull android.location.LocationListener locationListener
            , @NonNull LocationRequest locationRequest); @Override void setUpdateIntervals(long updateInterval, long fastestUpdateInterval); @NonNull @Override String getProvider(); @Override boolean isProviderEnabled(); @Override void close(); FusedLocationProviderClient getFusedLocationClient();  }