This document describes the elements you can use to populate the guidance cards for the turn-by-turn feed.
Navigation card information fields
When the driver enters guided navigation, a navigation card appears at the top, containing navigation date populated from the Navigation SDK. The related image shows an example of these essential navigation elements.
This table shows the fields for navigation info and where you find them.
Fields for each navigation step | Fields for the overall trip |
---|---|
Found in StepInfo |
Found in NavInfo |
Full road name | Remaining time |
The maneuver icon | Distance to destination |
Distance to the next step | |
Lane guidance fields |
Lane guidance
The Navigation SDK represents lanes in the navigation turn card as Lane and LaneDirection data objects. A Lane
object represents a specific lane during navigation and has a list of LaneDirection
objects which describe all the turns that can be made from this lane.
The recommended direction a driver should take in a lane is marked via the isRecommended field.
Lane guidance example
The following snippet illustrates the data representation of the lanes displayed above.
// Lane 1
LaneDirections = [{/*laneShape=*/ STRAIGHT, /*isRecommended=*/ false},
{/*laneShape=*/ SLIGHT_LEFT, /*isRecommended=*/ true}]
// Lane 2
LaneDirections = [{/*laneShape=*/ STRAIGHT, /*isRecommended=*/ false}]
Create icons for maneuvers
The
Maneuver
enum defines each possible maneuver that could occur while navigating, and you
can get the maneuver for a given step from the StepInfo.getManeuver()
method.
You must create maneuver icons and pair them with their associated maneuvers.
For some maneuvers, you can set up a one-to-one mapping to an icon, such as
DESTINATION_LEFT
and DESTINATION_RIGHT
. However, since some maneuvers are
similar, you might want to map more than one maneuver to a single icon. For
example TURN_LEFT
and ON_RAMP_LEFT
could both map to the left turn icon.
Some maneuvers contain an additional clockwise
or counterclockwise
label,
which the SDK determines based on the driving side of a country. For example, in
countries where driving is on the left side of the road, drivers take a
roundabout or U-turn in a clockwise direction, whereas right-side-of-the-road
countries go clockwise. The Navigation SDK detects
whether a maneuver occurs in left- or right-side traffic and outputs the
appropriate maneuver. Therefore, your maneuver icon may be different for a
clockwise versus a counterclockwise maneuver.
Expand to see examples icons for different maneuvers
Sample Icon | TurnByTurn Maneuvers |
---|---|
![]() |
DEPART UNKNOWN |
![]() |
STRAIGHT ON_RAMP_UNSPECIFIED OFF_RAMP_UNSPECIFIED NAME_CHANGE
|
![]() |
TURN_RIGHT ON_RAMP_RIGHT
|
![]() |
TURN_LEFT ON_RAMP_LEFT
|
![]() |
TURN_SLIGHT_RIGHT ON_RAMP_SLIGHT_RIGHT OFF_RAMP_SLIGHT_RIGHT
|
![]() |
TURN_SLIGHT_LEFT ON_RAMP_SLIGHT_LEFT OFF_RAMP_SLIGHT_LEFT
|
![]() |
TURN_SHARP_RIGHT ON_RAMP_SHARP_RIGHT OFF_RAMP_SHARP_RIGHT
|
![]() |
TURN_SHARP_LEFT ON_RAMP_SHARP_LEFT OFF_RAMP_SHARP_LEFT
|
![]() |
TURN_U_TURN_COUNTERCLOCKWISE ON_RAMP_U_TURN_COUNTERCLOCKWISE OFF_RAMP_U_TURN_COUNTERCLOCKWISE
|
![]() |
TURN_U_TURN_CLOCKWISE ON_RAMP_U_TURN_CLOCKWISE OFF_RAMP_U_TURN_CLOCKWISE
|
![]() |
ROUNDABOUT_SHARP_RIGHT_COUNTERCLOCKWISE
|
![]() |
ROUNDABOUT_SHARP_RIGHT_CLOCKWISE
|
![]() |
ROUNDABOUT_RIGHT_COUNTERCLOCKWISE
|
![]() |
ROUNDABOUT_RIGHT_CLOCKWISE
|
![]() |
ROUNDABOUT_SLIGHT_RIGHT_COUNTERCLOCKWISE
|
![]() |
ROUNDABOUT_SLIGHT_RIGHT_CLOCKWISE
|
![]() |
ROUNDABOUT_STRAIGHT_COUNTERCLOCKWISE
|
![]() |
ROUNDABOUT_STRAIGHT_CLOCKWISE
|
![]() |
ROUNDABOUT_SLIGHT_LEFT_COUNTERCLOCKWISE
|
![]() |
ROUNDABOUT_SLIGHT_LEFT_CLOCKWISE
|
![]() |
ROUNDABOUT_LEFT_COUNTERCLOCKWISE
|
![]() |
ROUNDABOUT_LEFT_CLOCKWISE
|
![]() |
ROUNDABOUT_SHARP_LEFT_COUNTERCLOCKWISE
|
![]() |
ROUNDABOUT_SHARP_LEFT_CLOCKWISE
|
![]() |
ROUNDABOUT_U_TURN_COUNTERCLOCKWISE
|
![]() |
ROUNDABOUT_U_TURN_CLOCKWISE
|
![]() |
ROUNDABOUT_COUNTERCLOCKWISE
|
![]() |
ROUNDABOUT_CLOCKWISE
|
![]() |
ROUNDABOUT_EXIT_COUNTERCLOCKWISE
|
![]() |
ROUNDABOUT_EXIT_CLOCKWISE
|
![]() |
MERGE_RIGHT OFF_RAMP_RIGHT
|
![]() |
MERGE_LEFT OFF_RAMP_LEFT
|
![]() |
FORK_RIGHT TURN_KEEP_RIGHT ON_RAMP_KEEP_RIGHT OFF_RAMP_KEEP_RIGHT
|
![]() |
FORK_LEFT TURN_KEEP_LEFT ON_RAMP_KEEP_LEFT OFF_RAMP_KEEP_LEFT
|
![]() |
MERGE_UNSPECIFIED
|
![]() |
DESTINATION
|
![]() |
DESTINATION_RIGHT
|
![]() |
DESTINATION_LEFT
|
![]() |
FERRY_BOAT
|
![]() |
FERRY_TRAIN
|
Use generated icons
To facilitate Android Auto use cases, the Navigation SDK supports generation of maneuver and lane guidance icons. These icons fit the image sizing guidance of the Android Auto Car App library which recommends targeting a 500 x 74 dp bounding box. See setsLaneImage and CarIcon in the Android reference documentation for details.
Icon generation example
NavigationUpdatesOptions options =
NavigationUpdatesOptions.builder()
.setNumNextStepsToPreview(numNextStepsToPreview)
.setGeneratedStepImagesType(GeneratedStepImagesType.BITMAP)
.setDisplayMetrics(getResources().getDisplayMetrics())
.build();
boolean isRegistered =
navigator.registerServiceForNavUpdates(
getPackageName(),
NavInfoReceivingService.class.getName(),
options);
After you enable icon generation, the TurnbyTurn StepInfo
object populates the
maneuverBitmap and lanesBitmap fields with the icons.