Search in sources :

Example 21 with Criteria

use of android.location.Criteria in project android_frameworks_base by ResurrectionRemix.

the class LocationManagerTest method testGetBestProviderPowerCriteria.

public void testGetBestProviderPowerCriteria() {
    Criteria c = new Criteria();
    c.setPowerRequirement(Criteria.POWER_HIGH);
    String p = manager.getBestProvider(c, true);
    assertNotNull(p);
    c.setPowerRequirement(Criteria.POWER_MEDIUM);
    p = manager.getBestProvider(c, true);
    assertNotNull(p);
    c.setPowerRequirement(Criteria.POWER_LOW);
    p = manager.getBestProvider(c, true);
    assertNotNull(p);
    c.setPowerRequirement(Criteria.NO_REQUIREMENT);
    p = manager.getBestProvider(c, true);
    assertNotNull(p);
}
Also used : Criteria(android.location.Criteria)

Example 22 with Criteria

use of android.location.Criteria in project android_frameworks_base by ResurrectionRemix.

the class LocationManagerTest method testGetBestProviderEmptyCriteria.

public void testGetBestProviderEmptyCriteria() {
    String p = manager.getBestProvider(new Criteria(), true);
    assertNotNull(p);
}
Also used : Criteria(android.location.Criteria)

Example 23 with Criteria

use of android.location.Criteria in project Ushahidi_Android by ushahidi.

the class Util method createFineCriteria.

/** this criteria needs high accuracy, high power, and cost */
public static Criteria createFineCriteria() {
    Criteria c = new Criteria();
    c.setAccuracy(Criteria.ACCURACY_FINE);
    c.setAltitudeRequired(false);
    c.setBearingRequired(false);
    c.setSpeedRequired(false);
    c.setCostAllowed(true);
    c.setPowerRequirement(Criteria.POWER_HIGH);
    return c;
}
Also used : Criteria(android.location.Criteria)

Example 24 with Criteria

use of android.location.Criteria in project Ushahidi_Android by ushahidi.

the class Util method createCoarseCriteria.

/** this criteria will settle for less accuracy, high power, and cost */
public static Criteria createCoarseCriteria() {
    Criteria c = new Criteria();
    c.setAccuracy(Criteria.ACCURACY_COARSE);
    c.setAltitudeRequired(false);
    c.setBearingRequired(false);
    c.setSpeedRequired(false);
    c.setCostAllowed(true);
    c.setPowerRequirement(Criteria.POWER_HIGH);
    return c;
}
Also used : Criteria(android.location.Criteria)

Example 25 with Criteria

use of android.location.Criteria in project dagger-test-example by aschattney.

the class LocationProvider method getBestProvider.

private String getBestProvider() {
    Criteria criteria = new Criteria();
    criteria.setCostAllowed(false);
    criteria.setAccuracy(Criteria.ACCURACY_LOW);
    return locationManager.getBestProvider(criteria, false);
}
Also used : Criteria(android.location.Criteria)

Aggregations

Criteria (android.location.Criteria)51 Location (android.location.Location)19 Test (org.junit.Test)12 LocationManager (android.location.LocationManager)8 ArrayList (java.util.ArrayList)8 PendingIntent (android.app.PendingIntent)6 Intent (android.content.Intent)6 Bundle (android.os.Bundle)6 Handler (android.os.Handler)6 LocationListener (android.location.LocationListener)5 SuppressLint (android.annotation.SuppressLint)2 FacebookException (com.facebook.FacebookException)2 HashMap (java.util.HashMap)2 Prefs (nodomain.freeyourgadget.gadgetbridge.util.Prefs)2 PackageManager (android.content.pm.PackageManager)1 ResolveInfo (android.content.pm.ResolveInfo)1 EditTextPreference (android.preference.EditTextPreference)1 ListPreference (android.preference.ListPreference)1 Preference (android.preference.Preference)1 PreferenceCategory (android.preference.PreferenceCategory)1