Lines Matching defs:location

27 import android.location.Criteria;
28 import android.location.Location;
29 import android.location.LocationListener;
30 import android.location.LocationManager;
31 import android.location.LocationRequest;
90 /** Interval of location updated in ms */
93 /** Maximum acceptable age of the location in ms */
116 /** Last known location, can be null or out of date */
123 /** Reference to the system's location manager */
127 * Get a reference to the current location.
167 * previously close to the current location (near printers).
182 Location location = getCurrentLocation();
184 // Add the favorite printers that have last been used close to the current location
186 if (location != null) {
198 if (printerLocation.distanceTo(location) <= MAX_PRINTER_DISTANCE) {
263 // Jumpstart location with a single forced update
337 Location location) {
340 && Objects.equals(mLocationOfLastPrinterUpdate, location)) {
344 mLocationOfLastPrinterUpdate = location;
406 * Check if the location is acceptable. This is to filter out excessively old or inaccurate
407 * location updates.
409 * @param location the location to check
410 * @return true iff the location is usable.
412 private boolean isLocationAcceptable(Location location) {
413 return location != null
414 && location.getElapsedRealtimeNanos() > SystemClock.elapsedRealtimeNanos()
416 && location.hasAccuracy()
417 && location.getAccuracy() < MIN_LOCATION_ACCURACY;
421 public void onLocationChanged(Location location) {
425 // as the location provider might send an update slightly too early.
426 if (isLocationAcceptable(location)
427 && !location.equals(mLocation)
429 || location
433 || location.getAccuracy() < mLocation.getAccuracy()))) {
434 // Other callers of updatePrinters might want to know the location, hence cache it
435 mLocation = location;
516 private static final String TAG_LOCATION = "location";
675 Location location = getCurrentLocation();
676 if (!isLocationAcceptable(location)) {
677 location = null;
680 mHistoricalPrinters.add(new Pair<PrinterInfo, Location>(printer, location));
715 * only at this time we know the location to use to determine if a printer is close enough
925 Location location;
927 location = new Location("");
928 location.setLongitude(
930 location.setLatitude(
932 location.setAccuracy(
940 location = null;
951 outPrinters.add(new Pair<PrinterInfo, Location>(printer, location));
1034 Location location = printers.get(i).second;
1035 if (location != null) {
1038 String.valueOf(location.getLongitude()));
1040 String.valueOf(location.getLatitude()));
1042 String.valueOf(location.getAccuracy()));