Code example for Criteria

Methods: setAccuracy

0
    criteria.setAccuracy(Criteria.ACCURACY_COARSE);
 
    Intent someIntent = new Intent("some_action");
    PendingIntent someLocationListenerPendingIntent = PendingIntent.getBroadcast(Robolectric.getShadowApplication().getApplicationContext(), 0,
        someIntent, PendingIntent.FLAG_UPDATE_CURRENT);
    Criteria someCriteria = new Criteria();
    someCriteria.setAccuracy(Criteria.ACCURACY_COARSE);
    locationManager.requestLocationUpdates(0, 0, someCriteria, someLocationListenerPendingIntent);
 
    assertThat(shadowLocationManager.getRequestLocationUdpateCriteriaPendingIntents().get(someLocationListenerPendingIntent)).isEqualTo(someCriteria);
  } 
 
  private Listener addGpsListenerToLocationManager() {
    Listener listener = new TestGpsListener();
    locationManager.addGpsStatusListener(listener);
    return listener;
  } 
 
  private static class TestLocationListener implements LocationListener {
    public boolean providerEnabled;