Platform
Product

Route Progress Object

The RouteProgress class contains all the user's progress information along the route, including leg and steps. This object's provided inside ProgressChangeListener, allowing you to get distance measurements, the percentage of route complete, current step index, and much more.

On progress change

Like tracking user location changes, this listener's invoked every time the user's location changes but provides an updated RouteProgress object. It is strongly encouraged to use this listener since you can typically refresh most of your application's user interface. An example of this will be if you are displaying the user's current progress until the user needs to do the next maneuver. Every time this listener's invoked, you can update your view with the new information from RouteProgress.

Besides receiving information about the route progress, the callback also provides you with the user's current location which can provide their current speed, bearing, etc. If you have the snap to route enabled, the location object will be updated to give the snapped coordinates.

navigation.addProgressChangeListener(new ProgressChangeListener() {
@Override
public void onProgressChange(Location location, RouteProgress routeProgress) {
}
});
RouteProgress APIsDescription
directionsRouteThe route acquired from the directions API and being used for navigation.
distanceTraveledThe total distance the user has traveled along the route.
legIndexThe route's current leg index that the user's on.
currentLegThe route's current leg as arouteLegobject.
distanceRemainingProvides the distance remaining in meters till the user reaches the end of the route.
durationRemainingThe estimated duration remaining till the user arrives at their destination.
fractionTraveledAfloatvalue between 0 and 1 giving the total percentage the user has completed in the navigation session, based on distance.
currentLegProgressreturns theLegProgressobject with information specific to the current route leg. You can also access step information through this object.
remainingWaypointsNumber of waypoints remaining on the current route.
currentStepPointsList ofPoints representing the current step geometry.
upcomingStepPointsList ofPoints representing the upcoming step geometry.
RouteLegProgress APIsDescription
currentStepProgressreturns thestepProgressobject with information specific to the current route step.
stepIndexThe route's current step index the user's on.
distanceTraveledTotal distance the user has traveled along the current leg.
durationRemainingThe estimated duration remaining till the user reaches the last maneuver in current route leg.
fractionTraveledAfloatvalue between 0 and 1 giving the total percentage the user has traveled along the current route leg, based on distance.
distanceRemainingThe total distance the user has traveled along the current leg.
previousStepGet the previous step the user traversed along, if the user is still on the first step, this will return null.
currentStepReturns the current step the user is traversing along. Should be used to provide voice / banner instructions.
upComingStepGet the next/upcoming step immediately after the current step. If the user is on the last step on the last leg, this will return null since a next step doesn't exist.
currentLegAnnotationProvides the current annotation data that theLocationupdates are traveling along. Note: theDirectionsRoutemust be requested withANNOTATION_DISTANCEto enable this within the RouteProgress - we now do this by default inNavigationRoute.
StepProgress APIsDescription
distanceTraveledTotal distance the user has traveled along the current step.
durationRemainingThe estimated duration remaining till the user reaches the next step maneuver.
fractionTraveledAfloatvalue between 0 and 1 giving the total percentage the user has traveled along the current step.
distanceRemainingThe total distance the user has traveled along the current step.
currentIntersectionAn intersection is considered a current intersection once passed through and will remain so until a different intersection is passed through.
upcomingIntersectionThe intersection being traveled towards on the route. Will be null if the upcoming step is null (last step of the leg).