Route Simulation With Instructions
In this guide you will learn how to simulate navigation along a computed route rendered on an interactive map, from a departure position to a desired destination. The navigation includes on-screen text and turn arrow instructions in a panel at the top, as well as a bottom panel showing estimated time of arrival (ETA) at the destination, remaining trip time, and remaining travel distance.
A navigation is started similar to Route Navigation Example but instead of starting a real navigation a simulation is started instead.
Since a simulation doesn't need current location there is no need to use PositionService
to listen for valid positions nor is it needed to have location permission.
The navigation listener has an onNavigationInstructionUpdated
callback instance which passes NavigationInstruction
objects while the navigation is ongoing.
The top navigation panel displays:
- the turn arrow icon,
instrIcon
; - distance,
instrDistance
; - and an optional instruction,
instrText
.
The bottom navigation panel contains:
- ETA - estimated time of arrival,
etaText
; - RTT - remaining travel time,
rttText
; - RTD - remaining travel distance,
rtdText
.
To get the ETA text:
To get the RTT text:
To get the RTD text:
To get the total remaining distance use: