List of usage examples for android.location Criteria POWER_HIGH
int POWER_HIGH
To view the source code for android.location Criteria POWER_HIGH.
Click Source Link
From source file:com.marianhello.cordova.bgloc.LocationUpdateService.java
/** * TODO Experimental cell-tower change system; something like ios significant changes. */// w ww.ja v a 2s.c om public void onCellLocationChange(CellLocation cellLocation) { Log.i(TAG, "- onCellLocationChange" + cellLocation.toString()); if (isDebugging) { Toast.makeText(this, "Cellular location change", Toast.LENGTH_LONG).show(); startTone("chirp_chirp_chirp"); } if (!isMoving && stationaryLocation != null) { criteria.setAccuracy(Criteria.ACCURACY_FINE); criteria.setHorizontalAccuracy(Criteria.ACCURACY_HIGH); criteria.setPowerRequirement(Criteria.POWER_HIGH); locationManager.requestSingleUpdate(criteria, singleUpdatePI); } }
From source file:com.google.ytd.SubmitActivity.java
private void getVideoLocation() { this.locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE); Criteria criteria = new Criteria(); criteria.setAccuracy(Criteria.ACCURACY_FINE); criteria.setPowerRequirement(Criteria.POWER_HIGH); criteria.setAltitudeRequired(false); criteria.setBearingRequired(false);//from w w w . j ava2 s. co m criteria.setSpeedRequired(false); criteria.setCostAllowed(true); String provider = locationManager.getBestProvider(criteria, true); this.locationListener = new LocationListener() { @Override public void onLocationChanged(Location location) { if (location != null) { SubmitActivity.this.videoLocation = location; double lat = location.getLatitude(); double lng = location.getLongitude(); Log.d(LOG_TAG, "lat=" + lat); Log.d(LOG_TAG, "lng=" + lng); TextView locationText = (TextView) findViewById(R.id.locationLabel); locationText.setText("Geo Location: " + String.format("lat=%.2f lng=%.2f", lat, lng)); locationManager.removeUpdates(this); } else { Log.d(LOG_TAG, "location is null"); } } @Override public void onProviderDisabled(String provider) { } @Override public void onProviderEnabled(String provider) { } @Override public void onStatusChanged(String provider, int status, Bundle extras) { } }; if (provider != null) { locationManager.requestLocationUpdates(provider, 2000, 10, locationListener); } }
From source file:com.BeatYourRecord.SubmitActivity.java
private void getVideoLocation() { this.locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE); Criteria criteria = new Criteria(); criteria.setAccuracy(Criteria.ACCURACY_FINE); criteria.setPowerRequirement(Criteria.POWER_HIGH); criteria.setAltitudeRequired(false); criteria.setBearingRequired(false);/*from w ww . j ava2s . c om*/ criteria.setSpeedRequired(false); criteria.setCostAllowed(true); String provider = locationManager.getBestProvider(criteria, true); this.locationListener = new LocationListener() { @Override public void onLocationChanged(Location location) { if (location != null) { SubmitActivity.this.videoLocation = location; lat = location.getLatitude(); lng = location.getLongitude(); Log.d(LOG_TAG, "lat=" + lat); Log.d(LOG_TAG, "lng=" + lng); TextView locationText = (TextView) findViewById(R.id.locationLabel); locationText.setText("Geo Location: " + String.format("lat=%.2f lng=%.2f", lat, lng)); locationManager.removeUpdates(this); } else { Log.d(LOG_TAG, "location is null"); } } @Override public void onProviderDisabled(String provider) { } @Override public void onProviderEnabled(String provider) { } @Override public void onStatusChanged(String provider, int status, Bundle extras) { } }; if (provider != null) { locationManager.requestLocationUpdates(provider, 2000, 10, locationListener); } }