Code example for Criteria

Methods: setAccuracy

0
  @Test 
  public void shouldThrowExceptionWhenRequestingLocationUpdatesAndNoProviderIsFound() throws Exception { 
    Intent someIntent = new Intent("some_action");
    PendingIntent someLocationListenerPendingIntent = PendingIntent.getBroadcast(Robolectric.getShadowApplication().getApplicationContext(), 0,
        someIntent, PendingIntent.FLAG_UPDATE_CURRENT);
    Criteria criteria = new Criteria();
    criteria.setAccuracy(Criteria.ACCURACY_FINE);
    try { 
      shadowLocationManager.requestLocationUpdates(0, 0, criteria, someLocationListenerPendingIntent);
      Assert.fail("When requesting location updates the intent must not be null!");
    } catch (Exception e) {
      // No worries, everything is fine... 
    } 
  } 
 
  @Test 
  public void shouldThrowExceptionIfTheBestProviderIsUnknown() throws Exception { 
    Criteria criteria = new Criteria();
    criteria.setAccuracy(Criteria.ACCURACY_FINE);
    try { 
      shadowLocationManager.setBestProvider("BEST_ENABLED_PROVIDER", true);