public interface NavigationProgressListener
Modifier and Type | Interface and Description |
---|---|
static interface |
NavigationProgressListener.DestinationAcceptanceHandler
Defines the handler passed to the host app as part of the onDestinationReached callback.
|
Modifier and Type | Method and Description |
---|---|
void |
onDestinationReached(Destination destination,
boolean isFinalDestination,
RouteLeg routeLegCompleted,
NavigationProgressListener.DestinationAcceptanceHandler destinationAcceptanceHandler)
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; whether currently on- or off-route.
|
void |
onUpcomingManeuverUpdated(Maneuver upcomingManeuver) |
void onLocationObservationReceived(LocationObservation locationObservation)
Essentially, this listener method is called each time a location update is received from the
LocationProviderAdapter
specified for the NavigationManager
.
Note that the LocationObservation
parameter contains the location's raw GPS coordinates,
the "snapped to route" location coordinates, as well as a few other utility values -- such as
the distance to the next upcoming manuever, and the remaining distance to travel on the current
route-leg -- see LocationObservation.getDistanceToUpcomingManeuver()
and LocationObservation.getRemainingLegDistance()
.
However, when the user is not on-route, the LocationObservation
supplied will
simply provide the raw location for the value of LocationObservation.getSnappedLocation()
-- since the user is off-route and therefore the "snapped" location is no longer really applicable.
Similarly, when off-route, the other fields in the LocationObservation
will also default
to "dummy" values in this case -- for example LocationObservation.getSnappedPosition()
}
will be zero; as well as the distanceFromRawLocationToSnappedLocation,
the distanceToUpcomingManeuver, and the remainingLegDistance.
The value of LocationObservation.getCurrentRouteLeg()
, however, will still be valid even
when off-route -- so the host-app can still compute or update its UI with any route-related updates
while in this state, as appropriate for the given application. However, of course, if the user
remains off-route for some time, the value for the current route-leg will become stale and
perhaps no longer applicable.
locationObservation
- the location observation containing the "raw" GPS location,
the "snapped" location, etc -- as described abovevoid onUpcomingManeuverUpdated(Maneuver upcomingManeuver)
void onInaccurateObservationReceived(Location location)
void onDestinationReached(Destination destination, boolean isFinalDestination, RouteLeg routeLegCompleted, NavigationProgressListener.DestinationAcceptanceHandler destinationAcceptanceHandler)
isFinalDestination
is true, then routeLegCompleted
is the last route leg completed.
destinationAcceptanceHandler
- a handler to be used by the client to indicate whether that the user has
indeed arrived at one of their intermediate destinations. Passing true would
advance the route leg. This callback can be used in conjunction with a dialog
(e.g. "Continue Navigation? Or Pause?")