You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Added support for route tokens
BREAKING CHANGE: Updates setDestinations call signature. DisplayOptions, RoutingOptions and RouteTokenOptions are now optional named parameters.
> To avoid this, ensure that the SDK has provided a valid user location before calling the setDestinations function. You can do this by subscribing to the onLocationChanged navigation callback and waiting for the first valid location update.
242
242
243
+
#### Using Route Tokens
244
+
245
+
You can use a pre-computed route from the [Routes API](https://developers.google.com/maps/documentation/routes) by providing a route token. This is useful when you want to ensure the navigation follows a specific route that was calculated server-side.
246
+
247
+
To use a route token:
248
+
249
+
1. Pass the token using `routeTokenOptions` instead of `routingOptions`
250
+
2.**Important:** The waypoints passed to `setDestinations` must match the waypoints used when generating the route token
251
+
252
+
```tsx
253
+
const waypoint = {
254
+
title: 'Destination',
255
+
position: { lat: 37.7749, lng: -122.4194 },
256
+
};
257
+
258
+
const routeTokenOptions = {
259
+
routeToken: 'your-route-token-from-routes-api',
260
+
travelMode: TravelMode.DRIVING, // Must match the travel mode used to generate the token
0 commit comments