@Override public void onReceive(Context context, Intent intent) { location = NovoCompass.getLocator().getLocation(); magField = new GeomagneticField((float) location.getLatitude(), (float) location.getLongitude(), (float) location.getAltitude(), System.currentTimeMillis()); } };
public LocationAssert hasAltitude(double altitude) { isNotNull(); double actualAltitude = actual.getAltitude(); assertThat(actualAltitude) // .overridingErrorMessage("Expected altitude <%s> but was <%s>.", altitude, actualAltitude) // .isEqualTo(altitude); return this; }
coordinates.put(PARAM_ALTITUDE, location.getAltitude());
private Location copyOf(Location location) { if (location == null) return null; Location copy = new Location(location); copy.setAccuracy(location.getAccuracy()); copy.setAltitude(location.getAltitude()); copy.setBearing(location.getBearing()); copy.setExtras(location.getExtras()); copy.setLatitude(location.getLatitude()); copy.setLongitude(location.getLongitude()); copy.setProvider(location.getProvider()); copy.setSpeed(location.getSpeed()); copy.setTime(location.getTime()); return copy; }
public void setLocation(Location location) { GeomagneticField geomagneticField = new GeomagneticField( (float) location.getLatitude(), (float) location.getLongitude(), (float) location.getAltitude(), System.currentTimeMillis()); declination = (float) Math.toRadians(geomagneticField.getDeclination()); } }
/** * Returns the current altitude * * @return the current altitude (if detected) or `0` */ public double getAltitude() { if (mPosition == null) { return 0.0f; } else { return mPosition.getAltitude(); } }
/** * Transform a Location into a LatLng point * @param aLocation */ public LatLng(final Location aLocation) { this(aLocation.getLatitude(), aLocation.getLongitude(), aLocation.getAltitude()); }
public Position(Location location) { this.mStorage[LAT_IDX] = location.getLatitude(); this.mStorage[LON_IDX] = location.getLongitude(); this.mStorage[ALT_IDX] = location.getAltitude(); }
/** * Set the GeomagneticField based on a Location. Note that this should only be called when there has been a significant change in location. * @param location The location to use for the compensation. */ public void setGeomagneticField(Location location) { geoMagField = new GeomagneticField((float) location.getLatitude(), (float) location.getLongitude(), (float) location.getAltitude(), System.currentTimeMillis()); } }
@Override public void onLocationChanged(Location location) { if (location.getLatitude() == dummyLat && location.getLongitude() == dummylong) { Toast.makeText(this,"Mock location application is working",Toast.LENGTH_SHORT).show(); }else { Toast.makeText(this,String.format(Locale.US,"setting mock to Latitude=%f, Longitude=%f Altitude=%f Accuracy=%f", location.getLatitude(), location.getLongitude(), location.getAltitude(), location.getAccuracy()),Toast.LENGTH_SHORT).show(); } } }
private void setLastLocation(Location location) { if (location != null) { SensorData sensorData = mSensorData[kSensorType_Location]; float[] values = new float[3]; values[0] = (float) location.getLatitude(); values[1] = (float) location.getLongitude(); values[2] = (float) location.getAltitude(); sensorData.values = values; } mControllerListAdapter.notifyDataSetChanged(); }
/** * Formats the altitude from the #Location into a string, with a * second unit field ("M" for meters). If the altitude is * unknown, it returns two empty fields. */ public String formatAltitude(Location location) { String s = ""; if (location.hasAltitude()) s += location.getAltitude() + ",M"; else s += ","; return s; }
public double getAltitudeCorrected(double AltitudeManualCorrection, boolean EGMCorrection) { if (_Location != null) { if (!_Location.hasAltitude()) return NOT_AVAILABLE; if ((EGMCorrection) && (getAltitudeEGM96Correction() != NOT_AVAILABLE)) return _Location.getAltitude() - getAltitudeEGM96Correction() + AltitudeManualCorrection; else return _Location.getAltitude() + AltitudeManualCorrection; } return NOT_AVAILABLE; } }
@Override public void onLocationChanged(Location location) { this.lat = location.getLatitude(); this.lng = location.getLongitude(); this.alt = location.getAltitude(); this.acc = location.getAccuracy(); this.time = location.getTime(); Toast.makeText(ctx, "Lat : "+this.lat+" \n Lng : "+this.lng+" \nAlt : "+this.alt+" \n Acc : "+this.acc+" \n Time : "+this.time, Toast.LENGTH_LONG).show(); changeRiderLocation(this.lat, this.lng); }
private void returnLocation() { if (mLocation != null) { Intent i = new Intent(); i.putExtra( FormEntryActivity.LOCATION_RESULT, mLocation.getLatitude() + " " + mLocation.getLongitude() + " " + mLocation.getAltitude() + " " + mLocation.getAccuracy()); setResult(RESULT_OK, i); } finish(); }
private void returnLocation() { if (mLocation != null) { Intent i = new Intent(); i.putExtra( FormEntryActivity.LOCATION_RESULT, mLocation.getLatitude() + " " + mLocation.getLongitude() + " " + mLocation.getAltitude() + " " + mLocation.getAccuracy()); setResult(RESULT_OK, i); } finish(); }
/** * Update the UI displaying the location data. */ private void updateLocationUI() { if (mCurrentLocation != null) { Toast.makeText(getApplicationContext(), "Location found: latitude: " + mCurrentLocation.getLatitude() + " - longitude: " + mCurrentLocation.getLongitude() + " - altitude: " + mCurrentLocation.getAltitude(), Toast.LENGTH_LONG).show(); if (Preferences.getPreference(getApplicationContext(), "pref_key_location_visibility", false)) { locationWrapper.setVisibility(View.VISIBLE); } stopLocationUpdates(); } }
public LocationAssert hasAltitude(double altitude) { isNotNull(); double actualAltitude = actual.getAltitude(); assertThat(actualAltitude) // .overridingErrorMessage("Expected altitude <%s> but was <%s>.", altitude, actualAltitude) // .isEqualTo(altitude); return this; }
@Override public void onLocationChanged(final Location location) { double systemTimestamp = System.currentTimeMillis() / 1e3d - mStartTime; if (mListener == null) { return; } mListener.onNewValues(systemTimestamp, location.getTime() / 1e3d - mStartTime, new Object[]{location.getLatitude(), location.getLongitude(), location.getAltitude(), location.getBearing(), location.getAccuracy(), location.getSpeed()}); }
@Override public void onLocationChanged(Location location) { altitude = location.getAltitude(); heading = location.getBearing(); speed = location.getSpeed(); handleMessage(new SimpleVehicleMessage("phone_altitude", altitude)); handleMessage(new SimpleVehicleMessage("phone_heading", heading)); handleMessage(new SimpleVehicleMessage("phone_speed", speed)); } }