use of net.osmand.plus.auto.NavigationSession in project Osmand by osmandapp.
the class OsmAndLocationProvider method setLocationFromService.
public void setLocationFromService(net.osmand.Location location) {
if (locationSimulation.isRouteAnimating() || shouldIgnoreLocation(location)) {
return;
}
if (location != null) {
lastTimeLocationFixed = System.currentTimeMillis();
notifyGpsLocationRecovered();
}
// notify about lost location
scheduleCheckIfGpsLost(location);
RoutingHelper routingHelper = app.getRoutingHelper();
app.getSavingTrackHelper().updateLocation(location, heading);
OsmandPlugin.updateLocationPlugins(location);
routingHelper.updateLocation(location);
app.getWaypointHelper().locationChanged(location);
NavigationSession carNavigationSession = app.getCarNavigationSession();
if (carNavigationSession != null && carNavigationSession.hasStarted()) {
carNavigationSession.updateLocation(location);
net.osmand.Location updatedLocation = location;
if (routingHelper.isFollowingMode()) {
if (location == null || isPointAccurateForRouting(location)) {
// Update routing position and get location for sticking mode
updatedLocation = routingHelper.setCurrentLocation(location, app.getSettings().SNAP_TO_ROAD.get());
}
}
this.location = updatedLocation;
updateLocation(this.location);
}
}
Aggregations