This example demonstrates how to calculate a route and fly the camera to one of its instructions. A route is computed between two waypoints (London and Paris), presented on the map, and the camera is then animated to centre on a single route instruction (a turn or manoeuvre along the way). The map remains fully interactive, supporting pan, pinch-zoom, rotate and tilt.
The route presented on the map with the camera centered on one instruction
Once the worldwide road map is confirmed up to date, the callback is cleared so it fires only once, then a route is calculated between two Landmark waypoints with calculateRoute.
calculateRoute returns an error code synchronously, indicating whether the calculation could be started. A non-NoError value means it never started, so the onCompleted callback won't fire - the error is therefore reported here with an error dialog.
When routing completes, the first route is taken, presented on the map without auto-centering, and an instruction is selected from its instructions list - the one at index 5, or the last one if the route has fewer instructions. That instruction is then passed to flyToInstruction.
flyToInstruction animates the camera to the chosen instruction with centerOnRouteInstruction. The instruction is centred on the middle of the free-space rectangle so it is not hidden behind the toolbar or the system bars.