Code example for Criteria

Methods: setAccuracy

0
    protected Location currentLocation;
 
    public IgnitedAbstractLastLocationFinder(Context context) {
        this.context = context.getApplicationContext();
        locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
        criteria = new Criteria();
        // Coarse accuracy is specified here to get the fastest possible result. 
        // The calling Activity will likely (or have already) request ongoing 
        // updates using the Fine location provider. 
        criteria.setAccuracy(Criteria.ACCURACY_COARSE);
    } 
 
    /** 
     * {@inheritDoc} 
     */ 
    @Override 
    public Location getLastBestLocation(int minDistance, long minTime,
            boolean refreshLocationIfLastIsTooOld) {
        Location bestResult = null;
        float bestAccuracy = Float.MAX_VALUE;
        long bestTime = Long.MIN_VALUE;