/** * Creates the {@link ContentValues} for a {@link Location}. * * @param location the location * @param trackId the track id */ private ContentValues createContentValues(Location location, long trackId) { ContentValues values = new ContentValues(); values.put(TrackPointsColumns.TRACKID, trackId); values.put(TrackPointsColumns.LONGITUDE, (int) (location.getLongitude() * 1E6)); values.put(TrackPointsColumns.LATITUDE, (int) (location.getLatitude() * 1E6)); // Hack for Samsung phones that don't properly populate the time field long time = location.getTime(); if (time == 0) { time = System.currentTimeMillis(); } values.put(TrackPointsColumns.TIME, time); if (location.hasAltitude()) { values.put(TrackPointsColumns.ALTITUDE, location.getAltitude()); } if (location.hasAccuracy()) { values.put(TrackPointsColumns.ACCURACY, location.getAccuracy()); } if (location.hasSpeed()) { values.put(TrackPointsColumns.SPEED, location.getSpeed()); } if (location.hasBearing()) { values.put(TrackPointsColumns.BEARING, location.getBearing()); } if (location instanceof MyTracksLocation) { MyTracksLocation myTracksLocation = (MyTracksLocation) location; if (myTracksLocation.getSensorDataSet() != null) { values.put(TrackPointsColumns.SENSOR, myTracksLocation.getSensorDataSet().toByteArray()); } } return values; }
/** * Creates a waypoint under the current track segment with the current time on which the waypoint * is reached * * @param track track * @param segment segment * @param latitude latitude * @param longitude longitude * @param time time * @param speed the measured speed * @return */ long insertWaypoint(long trackId, long segmentId, Location location) { // Log.d( TAG, "New waypoint ("+latitude+","+longitude+") with speed "+speed ); if (trackId < 0 || segmentId < 0) { throw new IllegalArgumentException("Track and segments may not the less then 0."); } SQLiteDatabase sqldb = getWritableDatabase(); ContentValues args = new ContentValues(); args.put(WaypointsColumns.SEGMENT, segmentId); args.put(WaypointsColumns.TIME, location.getTime()); args.put(WaypointsColumns.LATITUDE, location.getLatitude()); args.put(WaypointsColumns.LONGITUDE, location.getLongitude()); args.put(WaypointsColumns.SPEED, location.getSpeed()); args.put(WaypointsColumns.ACCURACY, location.getAccuracy()); args.put(WaypointsColumns.ALTITUDE, location.getAltitude()); args.put(WaypointsColumns.BEARING, location.getBearing()); long waypointId = sqldb.insert(Waypoints.TABLE, null, args); ContentResolver resolver = this.mContext.getContentResolver(); Uri notifyUri = ContentUris.withAppendedId(Tracks.CONTENT_URI, trackId); resolver.notifyChange(notifyUri, null); notifyUri = Uri.withAppendedPath(notifyUri, "segments/" + segmentId); resolver.notifyChange(notifyUri, null); notifyUri = Uri.withAppendedPath(notifyUri, "waypoints/" + waypointId); resolver.notifyChange(notifyUri, null); return waypointId; }
/** * Creates a waypoint under the current track segment with the current time on which the waypoint * is reached * * @param track track * @param segment segment * @param latitude latitude * @param longitude longitude * @param time time * @param speed the measured speed * @return */ long insertWaypoint(long trackId, long segmentId, Location location) { if (trackId < 0 || segmentId < 0) { throw new IllegalArgumentException("Track and segments may not the less then 0."); } SQLiteDatabase sqldb = getWritableDatabase(); ContentValues args = new ContentValues(); args.put(WaypointsColumns.SEGMENT, segmentId); args.put(WaypointsColumns.TIME, location.getTime()); args.put(WaypointsColumns.LATITUDE, location.getLatitude()); args.put(WaypointsColumns.LONGITUDE, location.getLongitude()); args.put(WaypointsColumns.SPEED, location.getSpeed()); args.put(WaypointsColumns.ACCURACY, location.getAccuracy()); args.put(WaypointsColumns.ALTITUDE, location.getAltitude()); args.put(WaypointsColumns.BEARING, location.getBearing()); // Log.d( TAG, "Waypoint time stored in the datebase"+ DateFormat.getInstance().format(new // Date( args.getAsLong( Waypoints.TIME ) ) ) ); long waypointId = sqldb.insert(Waypoints.TABLE, null, args); ContentResolver resolver = this.mContext.getContentResolver(); resolver.notifyChange( Uri.withAppendedPath(Tracks.CONTENT_URI, trackId + "/segments/" + segmentId + "/waypoints"), null); return waypointId; }
public void onLocationChanged(final Location location) { if (DEBUGMODE) { logger.debug("onLocationChanged(" + location + ")"); } // ignore temporary non-gps fix if (mIgnorer.shouldIgnore(location.getProvider(), System.currentTimeMillis())) { logger.debug("Ignore temporary non-gps location"); return; } mLocation = location; if (mFollow) { mMapController.setCenter(new GeoPoint(location)); } else { mMapView.postInvalidate(); // redraw the my location icon } for (final Runnable runnable : mRunOnFirstFix) { new Thread(runnable).start(); } mRunOnFirstFix.clear(); sogTxt.setText( String.valueOf((double) Math.round(location.getSpeed() * 1.94 * 100) / 100) + "kts | "); cogTxt.setText(String.valueOf(location.getBearing()) + "\u00B0 "); }
@Override public void onLocationChanged(Location location) { if (location.hasAccuracy()) { SpannableString s = new SpannableString(String.format("%.0f", location.getAccuracy()) + "m"); s.setSpan(new RelativeSizeSpan(0.75f), s.length() - 1, s.length(), 0); accuracy.setText(s); if (firstfix) { status.setText(""); fab.setVisibility(View.VISIBLE); if (!data.isRunning() && !maxSpeed.getText().equals("")) { refresh.setVisibility(View.VISIBLE); } firstfix = false; } } else { firstfix = true; } if (location.hasSpeed()) { progressBarCircularIndeterminate.setVisibility(View.GONE); SpannableString s = new SpannableString(String.format("%.0f", location.getSpeed() * 3.6) + "km/h"); s.setSpan(new RelativeSizeSpan(0.25f), s.length() - 4, s.length(), 0); currentSpeed.setText(s); } }
public void locationUpdated(LocationManager manager, Location location, boolean lastKnown) { // #debug info logger.info("updateLocation: " + location); if (location == null) { return; } hasFix = true; if (currentState != LocationProvider.AVAILABLE) { updateSolution(LocationProvider.AVAILABLE); } lastFixTimestamp = System.currentTimeMillis(); // #debug debug logger.debug("received Location: " + location); pos.latitude = (float) location.getLatitude(); pos.longitude = (float) location.getLongitude(); pos.altitude = (float) location.getAltitude(); pos.course = location.getBearing(); pos.speed = location.getSpeed(); pos.timeMillis = location.getTime(); pos.accuracy = location.getAccuracy(); if (lastKnown) { pos.type = Position.TYPE_GPS_LASTKNOWN; } else { pos.type = Position.TYPE_GPS; } receiverList.receivePosition(pos); // logger.trace("exit locationUpdated(provider,location)"); }
private void test05GetLastLocation() { mLocationManager = (LocationManager) getSystemService(LOCATION_SERVICE); Log.i(TAG, "test05GetLastLocation call getLastLocation()"); Location location = mLocationManager.getLastLocation(); Bundle bundle = new Bundle(); if (location != null) { Log.i(TAG, "getLastLocation() return not null"); bundle.putString( KEY_LOC, "getLatitude: " + location.getLatitude() + " getLongitude: " + location.getLongitude() + " getAltitude: " + location.getAltitude() + " getAccuracy: " + location.getAccuracy() + " getBearing: " + location.getBearing() + " getSpeed: " + location.getSpeed()); } else { Log.i(TAG, "getLastLocation() return null"); } removeDialog(DIALOG_LOC); showDialog(DIALOG_LOC, bundle); }
public void addPointNow(Location loc) { int lat = (int) (loc.getLatitude() * 1E6); int lgt = (int) (loc.getLongitude() * 1E6); float accuracy = loc.getAccuracy(); double altitude = loc.getAltitude(); float speed = loc.getSpeed(); endTime_ = (loc.getTime() / 1000); CyclePoint pt = new CyclePoint(lat, lgt, endTime_, accuracy, altitude, speed); if (gpspoints.size() > 1) { CyclePoint gp = gpspoints.get(gpspoints.size() - 1); float segmentDistance = gp.distanceTo(pt); if (segmentDistance == 0) return; // we haven't gone anywhere distance += segmentDistance; } // if ... gpspoints.add(pt); mDb.open(); mDb.addCoordToTrip(tripid, pt); mDb.setDistance(tripid, distance); mDb.close(); return; } // addPointNow
public void onLocationChanged(final Location loc) { if (loc != null) { boolean needWrite = false; if (mLastLocation != null) mDistanceFromLastWriting = +loc.distanceTo(mLastLocation); if (mLastWritedLocation != null) mTimeFromLastWriting = loc.getTime() - mLastWritedLocation.getTime(); if (mLastWritedLocation == null || mLastLocation == null) needWrite = true; else if (mTimeFromLastWriting > mMaxTime) needWrite = true; else if (mDistanceFromLastWriting > mMinDistance && mTimeFromLastWriting > mMinTime) needWrite = true; if (needWrite) { // Ut.dd("addPoint mDistanceFromLastWriting="+mDistanceFromLastWriting+" // mTimeFromLastWriting="+(mTimeFromLastWriting/1000)); mLastWritedLocation = loc; mLastLocation = loc; mDistanceFromLastWriting = 0; addPoint( loc.getLatitude(), loc.getLongitude(), loc.getAltitude(), loc.getSpeed(), System.currentTimeMillis()); mHandler.sendMessage(mHandler.obtainMessage(1, loc)); } else { // Ut.dd("NOT addPoint mDistanceFromLastWriting="+mDistanceFromLastWriting+" // mTimeFromLastWriting="+(mTimeFromLastWriting/1000)); mLastLocation = loc; } } }
@Override public void onLocationChanged(Location location) { Log.d(TAG, "- onLocationChanged" + location.toString()); if (config.isDebugging()) { Toast.makeText( FusedLocationService.this, "acy:" + location.getAccuracy() + ",v:" + location.getSpeed() + ",df:" + config.getDistanceFilter(), Toast.LENGTH_LONG) .show(); } // if (lastLocation != null && location.distanceTo(lastLocation) < config.getDistanceFilter()) { // return; // } if (config.isDebugging()) { startTone("beep"); } lastLocation = location; handleLocation(location); }
public void onLocationChanged(Location loc) { System.out.println("GPS scan received"); String record = gpsStatusCode + PayloadFieldDelimiter + loc.getTime() + PayloadFieldDelimiter + loc.getLatitude() + PayloadFieldDelimiter + loc.getLongitude() + PayloadFieldDelimiter + loc.getAltitude() + PayloadFieldDelimiter + loc.getAccuracy() + PayloadFieldDelimiter + loc.getSpeed() + PayloadFieldDelimiter + loc.getBearing() + PayloadFieldDelimiter + curGroundTruth; ; String timestamp = System.currentTimeMillis() + ""; logger.writeRecord(type, timestamp, record); debugStatus = LifeLogService.getReadableCurrentTime(); }
public void CalculateSpeed(LocationIdentifier previousLocation) { if (_location.hasSpeed()) _speed = _location.getSpeed(); else { double diff = (double) (getDateTime().getTime() - previousLocation.getDateTime().getTime()); double distance = _location.distanceTo(previousLocation.getLocation()); _speed = (float) (distance / diff * 3600.0); } }
// Returns the speed of the user private void getSpeed(Location location) { mySpeed = location.getSpeed() * 3.6; speedList.add(mySpeed); // Add current speed to the arraylist DecimalFormat speedFormat = new DecimalFormat("##.##"); String s = speedFormat.format(mySpeed); speed.setText(s + "km/h"); }
@Override public void onLocationChanged(Location location) { StringBuilder sb = new StringBuilder(); System.out.println("精确度:" + location.getAccuracy()); System.out.println("移动的速度:" + location.getSpeed()); System.out.println("纬度:" + location.getLatitude()); System.out.println("经度:" + location.getLongitude()); System.out.println("海拔:" + location.getAltitude()); sb.append("accuracy:" + location.getAccuracy() + "\n"); sb.append("speed:" + location.getSpeed() + "\n"); sb.append("weidu:" + location.getLatitude() + "\n"); sb.append("jingdu:" + location.getLongitude() + "\n"); String result = sb.toString(); SharedPreferences sp = getSharedPreferences("config", MODE_PRIVATE); SmsManager.getDefault() .sendTextMessage(sp.getString("safenumber", ""), null, result, null, null); stopSelf(); }
protected void drawMyLocation( final Canvas canvas, final MapView mapView, final Location lastFix, final GeoPoint myLocation) { final Projection pj = mapView.getProjection(); pj.toMapPixels(mMyLocation, mMapCoords); if (mDrawAccuracyEnabled) { final float radius = pj.metersToEquatorPixels(lastFix.getAccuracy()); mCirclePaint.setAlpha(50); mCirclePaint.setStyle(Style.FILL); canvas.drawCircle(mMapCoords.x, mMapCoords.y, radius, mCirclePaint); mCirclePaint.setAlpha(150); mCirclePaint.setStyle(Style.STROKE); canvas.drawCircle(mMapCoords.x, mMapCoords.y, radius, mCirclePaint); } canvas.getMatrix(mMatrix); mMatrix.getValues(mMatrixValues); if (DEBUGMODE) { final float tx = (-mMatrixValues[Matrix.MTRANS_X] + 20) / mMatrixValues[Matrix.MSCALE_X]; final float ty = (-mMatrixValues[Matrix.MTRANS_Y] + 90) / mMatrixValues[Matrix.MSCALE_Y]; canvas.drawText("Lat: " + lastFix.getLatitude(), tx, ty + 5, mPaint); canvas.drawText("Lon: " + lastFix.getLongitude(), tx, ty + 20, mPaint); canvas.drawText("Cog: " + lastFix.getBearing(), tx, ty + 35, mPaint); canvas.drawText("Acc: " + lastFix.getAccuracy(), tx, ty + 50, mPaint); canvas.drawText("Kts: " + lastFix.getSpeed() / 1.94384449, tx, ty + 65, mPaint); } // TODO: read from compass if available for bearing if (lastFix.hasBearing()) { /* * Rotate the direction-Arrow according to the bearing we are driving. And draw it * to the canvas. */ directionRotater.setRotate( lastFix.getBearing(), DIRECTION_ARROW_CENTER_X, DIRECTION_ARROW_CENTER_Y); directionRotater.postTranslate(-DIRECTION_ARROW_CENTER_X, -DIRECTION_ARROW_CENTER_Y); directionRotater.postScale( 1 / mMatrixValues[Matrix.MSCALE_X], 1 / mMatrixValues[Matrix.MSCALE_Y]); directionRotater.postTranslate(mMapCoords.x, mMapCoords.y); canvas.drawBitmap(DIRECTION_ARROW, directionRotater, mPaint); } else { directionRotater.setTranslate(-NULLDIRECTION_ICON_CENTER_X, -NULLDIRECTION_ICON_CENTER_Y); directionRotater.postScale( 1 / mMatrixValues[Matrix.MSCALE_X], 1 / mMatrixValues[Matrix.MSCALE_Y]); directionRotater.postTranslate(mMapCoords.x, mMapCoords.y); canvas.drawBitmap(NULLDIRECTION_ICON, directionRotater, mPaint); } }
public void broadcastLocationFound(Location location) { String deviceId = Settings.Secure.getString(this.getContentResolver(), Settings.Secure.ANDROID_ID); params = new RequestParams(); params.put("UID", deviceId); params.put("LAT", Double.toString(location.getLatitude())); params.put("LON", Double.toString(location.getLongitude())); params.put("ACU", Double.toString(location.getAccuracy())); params.put("SPD", Double.toString(location.getSpeed())); PersistentCookieStore CookieStore = new PersistentCookieStore(LocationService.this); CookieStore.clear(); AsyncHttpClient sendLocation = new AsyncHttpClient(false, 80, 443); sendLocation.setCookieStore(CookieStore); sendLocation.setTimeout(60000); sendLocation.post( url, params, new JsonHttpResponseHandler() { @Override public void onSuccess( int statusCode, cz.msebera.android.httpclient.Header[] headers, JSONObject response) { super.onSuccess(statusCode, headers, response); Log.i(TAG, response.toString()); } @Override public void onSuccess( int statusCode, cz.msebera.android.httpclient.Header[] headers, JSONArray response) { super.onSuccess(statusCode, headers, response); Log.i(TAG, response.toString()); } @Override public void onSuccess( int statusCode, cz.msebera.android.httpclient.Header[] headers, String responseString) { super.onSuccess(statusCode, headers, responseString); Log.i(TAG, responseString); } @Override public void onFailure( int statusCode, cz.msebera.android.httpclient.Header[] headers, String responseString, Throwable throwable) { super.onFailure(statusCode, headers, responseString, throwable); Log.v(TAG, responseString, throwable); } }); }
public Position(String deviceId, Location location, double battery) { this.deviceId = deviceId; time = new Date(location.getTime()); latitude = location.getLatitude(); longitude = location.getLongitude(); altitude = location.getAltitude(); speed = location.getSpeed() * 1.943844; // speed in knots course = location.getBearing(); this.battery = battery; }
public static GenericData createGenericData(Location location) { GPS gps = new GPS( location.getLatitude(), location.getLongitude(), location.getSpeed(), location.getBearing(), location.getAltitude(), location.getTime()); return gps; }
private void dynamicMonitoring(Location location) { double speed = location.getSpeed() * 6.3; if (speed > 100) { } else if (speed > 50) { } else { } }
ContentValues createContentValues(Waypoint waypoint) { ContentValues values = new ContentValues(); // Value < 0 indicates no id is available if (waypoint.getId() >= 0) { values.put(WaypointsColumns._ID, waypoint.getId()); } values.put(WaypointsColumns.NAME, waypoint.getName()); values.put(WaypointsColumns.DESCRIPTION, waypoint.getDescription()); values.put(WaypointsColumns.CATEGORY, waypoint.getCategory()); values.put(WaypointsColumns.ICON, waypoint.getIcon()); values.put(WaypointsColumns.TRACKID, waypoint.getTrackId()); values.put(WaypointsColumns.TYPE, waypoint.getType()); values.put(WaypointsColumns.LENGTH, waypoint.getLength()); values.put(WaypointsColumns.DURATION, waypoint.getDuration()); values.put(WaypointsColumns.STARTID, waypoint.getStartId()); values.put(WaypointsColumns.STOPID, waypoint.getStopId()); Location location = waypoint.getLocation(); if (location != null) { values.put(WaypointsColumns.LONGITUDE, (int) (location.getLongitude() * 1E6)); values.put(WaypointsColumns.LATITUDE, (int) (location.getLatitude() * 1E6)); values.put(WaypointsColumns.TIME, location.getTime()); if (location.hasAltitude()) { values.put(WaypointsColumns.ALTITUDE, location.getAltitude()); } if (location.hasAccuracy()) { values.put(WaypointsColumns.ACCURACY, location.getAccuracy()); } if (location.hasSpeed()) { values.put(WaypointsColumns.SPEED, location.getSpeed()); } if (location.hasBearing()) { values.put(WaypointsColumns.BEARING, location.getBearing()); } } TripStatistics tripStatistics = waypoint.getTripStatistics(); if (tripStatistics != null) { values.put(WaypointsColumns.STARTTIME, tripStatistics.getStartTime()); values.put(WaypointsColumns.TOTALDISTANCE, tripStatistics.getTotalDistance()); values.put(WaypointsColumns.TOTALTIME, tripStatistics.getTotalTime()); values.put(WaypointsColumns.MOVINGTIME, tripStatistics.getMovingTime()); values.put(WaypointsColumns.AVGSPEED, tripStatistics.getAverageSpeed()); values.put(WaypointsColumns.AVGMOVINGSPEED, tripStatistics.getAverageMovingSpeed()); values.put(WaypointsColumns.MAXSPEED, tripStatistics.getMaxSpeed()); values.put(WaypointsColumns.MINELEVATION, tripStatistics.getMinElevation()); values.put(WaypointsColumns.MAXELEVATION, tripStatistics.getMaxElevation()); values.put(WaypointsColumns.ELEVATIONGAIN, tripStatistics.getTotalElevationGain()); values.put(WaypointsColumns.MINGRADE, tripStatistics.getMinGrade()); values.put(WaypointsColumns.MAXGRADE, tripStatistics.getMaxGrade()); } return values; }
private void addLocation(Location location, JSONObject object, String prefix) throws JSONException { object.put(prefix + "_timestamp", location.getTime()); object.put(prefix + "_speed", location.getSpeed()); object.put(prefix + "_course", location.getBearing()); object.put(prefix + "_verticalAccuracy", location.getAccuracy()); object.put(prefix + "_horizontalAccuracy", location.getAccuracy()); object.put(prefix + "_altitude", location.getAltitude()); object.put(prefix + "_latitude", location.getLatitude()); object.put(prefix + "_longitude", location.getLongitude()); }
private void manageMap(Location originalLocation, Location location) { if (location != null) { zoomController.setAverageSpeed(getAverageSpeed()); zoomController.setCurrentSpeed(originalLocation.getSpeed()); if (isPaging) { mapController.setZoomLevel(zoomController.getZoom()); mapController.quarterOn(location, route.getCurrentRotationBearing()); } routeLocationIndicator.setRotation((float) route.getCurrentRotationBearing()); routeLocationIndicator.setPosition(location.getLatitude(), location.getLongitude()); mapFragment.updateMap(); } }
public String getCoordinates(Location loc) { JSONObject object = new JSONObject(); try { object.put("Latitude", loc.getLatitude()); object.put("Longitude", loc.getLongitude()); object.put("Speed", loc.getSpeed()); object.put("Accuracy", loc.getAccuracy()); } catch (JSONException e) { e.printStackTrace(); } return object.toString(); }
/** Format location message */ public static String createLocationMessage(boolean extended, Location l, double battery) { StringBuilder s = new StringBuilder(extended ? "$TRCCR," : "$GPRMC,"); Formatter f = new Formatter(s, Locale.ENGLISH); Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"), Locale.ENGLISH); calendar.setTimeInMillis(l.getTime()); if (extended) { f.format("%1$tY%1$tm%1$td%1$tH%1$tM%1$tS.%1$tL,A,", calendar); f.format("%.6f,%.6f,", l.getLatitude(), l.getLongitude()); f.format("%.2f,%.2f,", l.getSpeed() * 1.943844, l.getBearing()); f.format("%.2f,", l.getAltitude()); f.format("%.0f,", battery); } else { f.format("%1$tH%1$tM%1$tS.%1$tL,A,", calendar); double lat = l.getLatitude(); double lon = l.getLongitude(); f.format("%02d%07.4f,%c,", (int) Math.abs(lat), Math.abs(lat) % 1 * 60, lat < 0 ? 'S' : 'N'); f.format("%03d%07.4f,%c,", (int) Math.abs(lon), Math.abs(lon) % 1 * 60, lon < 0 ? 'W' : 'E'); double speed = l.getSpeed() * 1.943844; // speed in knots f.format("%.2f,%.2f,", speed, l.getBearing()); f.format("%1$td%1$tm%1$ty,,", calendar); } byte checksum = 0; for (byte b : s.substring(1).getBytes()) { checksum ^= b; } f.format("*%02x\r\n", (int) checksum); f.close(); return s.toString(); }
private void updateNewLocation(Location location) { LocationProviderAdapter.newLocationAvailable( location.getLatitude(), location.getLongitude(), location.getTime() / 1000.0, location.hasAltitude(), location.getAltitude(), location.hasAccuracy(), location.getAccuracy(), location.hasBearing(), location.getBearing(), location.hasSpeed(), location.getSpeed()); }
@Override public void onLocationChanged(Location location) { Log.d( TAG, "new location : " + location.getLatitude() + ", " + location.getLongitude() + ". " + location.getAccuracy() + " -> " + location.getSpeed() + ""); broadcastLocationFound(location); }
public String getCoordinates() { Location loc = mlocManager.getLastKnownLocation(LocationManager.GPS_PROVIDER); if (loc == null) return ""; JSONObject object = new JSONObject(); try { object.put("Latitude", loc.getLatitude()); object.put("Longitude", loc.getLongitude()); object.put("Speed", loc.getSpeed()); object.put("Accuracy", loc.getAccuracy()); } catch (JSONException e) { e.printStackTrace(); } return object.toString(); }
public void onLocationChanged(Location location) { showToast( "onLocationChanged() return: " + " getLatitude: " + location.getLatitude() + " getLongitude: " + location.getLongitude() + " getAltitude: " + location.getAltitude() + " getAccuracy: " + location.getAccuracy() + " getBearing: " + location.getBearing() + " getSpeed: " + location.getSpeed()); }
@Implementation public void set(Location l) { time = l.getTime(); provider = l.getProvider(); latitude = l.getLatitude(); longitude = l.getLongitude(); accuracy = l.getAccuracy(); bearing = l.getBearing(); altitude = l.getAltitude(); speed = l.getSpeed(); hasAccuracy = l.hasAccuracy(); hasAltitude = l.hasAltitude(); hasBearing = l.hasBearing(); hasSpeed = l.hasSpeed(); }
public static de.uvwxy.daisy.proto.Messages.Location androidLocationToProtoLocation( android.location.Location androLoc) { Preconditions.checkNotNull(androLoc); Messages.Location.Builder locBuilder = Messages.Location.newBuilder(); locBuilder.setLatitude(androLoc.getLatitude()); locBuilder.setLongitude(androLoc.getLongitude()); locBuilder.setAltitude(androLoc.getAltitude()); locBuilder.setBearing(androLoc.getBearing()); locBuilder.setAccuracy(androLoc.getAccuracy()); locBuilder.setTime(androLoc.getTime()); locBuilder.setSpeed(androLoc.getSpeed()); locBuilder.setProvider(androLoc.getProvider()); return locBuilder.build(); }