Code example for LocationManager: Getting continuous location updates

Methods: removeUpdatesrequestLocationUpdates

0
  } 
 
  @Test 
  public void shouldRemoveLocationListeners() throws Exception { 
    TestLocationListener listener = new TestLocationListener();
    locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 1, 2.0f, listener);
    locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1, 2.0f, listener);
 
    TestLocationListener otherListener = new TestLocationListener();
    locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 1, 2.0f, otherListener);
 
    locationManager.removeUpdates(listener);
 
    List<LocationListener> expected = new ArrayList<LocationListener>();
    expected.add(otherListener);
    assertThat(shadowLocationManager.getRequestLocationUpdateListeners()).isEqualTo(expected);
  } 
 
  @Test 
  public void shouldRemovePendingIntentsWhenRequestingLocationUpdatesUsingCriteria() throws Exception { 
    Intent someIntent = new Intent("some_action");