Get Navigation in your App

Approximate time: 5-10 mins

Now let's have some fun by adding turn-by-turn navigation to your app! This uses our Driving Simulator, so you can try this out right from the comfort of your desk.

// create the request with the date/time supplied as the departure time
TGRouteRequest routeRequest = new TGRouteRequest.Builder()
               .addCoordinate(34.101558d, -118.340944d) // Grauman's Chinese Theatre
               .addCoordinate(34.011441d, -118.494932d) // Santa Monica Pier
               .build();
LatLng currentLocation = routeRequest.getWayPoints().get(0).getCoordinate(); // Start from the first waypoint

// simulate navigation
TallyGo.getInstance().enableSimulation(true, false, currentLocation);

// launch the route preview screen
TGLauncher.startPreview(CONTEXT, routeRequest);

If you want to do live navigation in your app (and not using the Driving Simulator):

// create the request with the date/time supplied as the departure time
TGRouteRequest routeRequest = new TGRouteRequest.Builder()
               .addCurrentLocationWaypoint()
               .addCoordinate(34.011441d, -118.494932d) // Santa Monica Pier
               .build();

// launch the route preview screen
TGLauncher.startPreview(CONTEXT, routeRequest);

Voila! You now have turn-by-turn navigation in your app!