public class DefaultNavigationProgressListener extends java.lang.Object implements NavigationProgressListener
Constructor and Description |
---|
DefaultNavigationProgressListener() |
Modifier and Type | Method and Description |
---|---|
void |
onDestinationReached(boolean isFinalDestination,
RouteLeg routeLegCompleted)
Called when the user reaches one of the destinations on their route.
|
void |
onInaccurateObservationReceived(Location location)
Called when a location update is received while in a state where it cannot be adequately
determined whether the user is on- or off-route, due to a recent history of location updates
with poor accuracy.
|
void |
onLocationObservationReceived(LocationObservation locationObservation)
Called when the user's progress along the route has been updated.
|
void |
onUpcomingManeuverUpdated(Maneuver upcomingManeuver) |
public void onLocationObservationReceived(LocationObservation locationObservation)
NavigationProgressListener
LocationProviderAdapter
used by the NavigationManager
.
Note that a LocationObservation
contains both the location's raw GPS coordinates, the "snapped" (adjusted)
location coordinates, as well as a few other utility values -- such as the distance to the next upcoming manuever,
as well as the remaining distance to travel on the current route-leg -- see
LocationObservation.getDistanceToUpcomingManeuver()
and LocationObservation.getRemainingLegDistance()
.
onLocationObservationReceived
in interface NavigationProgressListener
locationObservation
- the location observation containing both a "raw" GPS location, the "snapped" location, etc.public void onUpcomingManeuverUpdated(Maneuver upcomingManeuver)
onUpcomingManeuverUpdated
in interface NavigationProgressListener
public void onDestinationReached(boolean isFinalDestination, RouteLeg routeLegCompleted)
NavigationProgressListener
isFinalDestination
is true, then routeLegCompleted
is the last route leg completed.
If the client wishes to show a dialog to the user when they've reached an intermediate destination
(e.g. "Continue Navigation? Or Pause?"), then they can simply check if isFinalDestination
is false,
and call NavigationManager.pauseNavigation()
to pause the session. Then, when the user wishes to resume
navigating, simply call NavigationManager.resumeNavigation()
.
onDestinationReached
in interface NavigationProgressListener
public void onInaccurateObservationReceived(Location location)
NavigationProgressListener
onInaccurateObservationReceived
in interface NavigationProgressListener