Example usage for android.location Criteria setVerticalAccuracy

List of usage examples for android.location Criteria setVerticalAccuracy

Introduction

In this page you can find the example usage for android.location Criteria setVerticalAccuracy.

Prototype

public void setVerticalAccuracy(int accuracy) 

Source Link

Document

Indicates the desired vertical accuracy (altitude).

Usage

From source file:net.frakbot.FWeather.util.LocationHelper.java

/**
 * Returns the default criteria set for the LocationManager.
 * @return the default Criteria//  w ww . ja  v  a 2 s  .  c  om
 */
private static Criteria getDefaultCriteria() {
    Criteria criteria = new Criteria();
    criteria.setCostAllowed(false);
    criteria.setHorizontalAccuracy(Criteria.ACCURACY_LOW);
    criteria.setVerticalAccuracy(Criteria.NO_REQUIREMENT);
    criteria.setSpeedRequired(false);
    criteria.setPowerRequirement(Criteria.POWER_LOW);

    return criteria;
}

From source file:name.gumartinm.weather.information.activity.MapActivity.java

public void onClickGetLocation(final View v) {
    // TODO: Somehow I should show a progress dialog.
    // If Google Play Services is available
    if (this.mLocationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) {
        // TODO: Hopefully there will be results even if location did not change...   
        final Criteria criteria = new Criteria();
        criteria.setAccuracy(Criteria.ACCURACY_FINE);
        criteria.setAltitudeRequired(false);
        criteria.setBearingAccuracy(Criteria.NO_REQUIREMENT);
        criteria.setBearingRequired(false);
        criteria.setCostAllowed(false);/*from  w w  w  .  ja v a  2 s  .  c om*/
        criteria.setHorizontalAccuracy(Criteria.ACCURACY_HIGH);
        criteria.setPowerRequirement(Criteria.POWER_MEDIUM);
        criteria.setSpeedAccuracy(Criteria.NO_REQUIREMENT);
        criteria.setSpeedRequired(false);
        criteria.setVerticalAccuracy(Criteria.ACCURACY_HIGH);

        this.mLocationManager.requestSingleUpdate(criteria, this, null);
    } else {
        Toast.makeText(this, this.getString(R.string.weather_map_not_enabled_location), Toast.LENGTH_LONG)
                .show();
    }
    // Trying to use the synchronous calls. Problems: mGoogleApiClient read/store from different threads.
    // new GetLocationTask(this).execute();
}