<iframe src="https://developers.devsite.google/frame/maps/documentation/javascript/reference/journey-sharing-fleet-tracking_c13eaef929f85f26a0a4e43467c1d453d89cc2252a657c34002ad2f7fa9d17f8.frame" class="framebox inherit-locale redirect-iframe" allow="clipboard-write https://developers.devsite.google" allowfullscreen is-upgraded></iframe>

## [FleetEngineDeliveryVehicleLocationProvider](https://developers.google.com/maps/documentation/javascript/reference/journey-sharing-fleet-tracking.md.txt#FleetEngineDeliveryVehicleLocationProvider)
class


class
`google.maps.journeySharing.FleetEngineDeliveryVehicleLocationProvider`
extends `PollingLocationProvider, LocationProvider`

library `"journeySharing"`

Delivery Vehicle Location Provider.

```javascript
const {FleetEngineDeliveryVehicleLocationProvider} = await google.maps.importLibrary("journeySharing");
```

| ### Constructor ||
|---|---|
| `FleetEngineDeliveryVehicleLocationProvider` | `FleetEngineDeliveryVehicleLocationProvider(options)` **Parameters:** - `options: FleetEngineDeliveryVehicleLocationProviderOptions` Options to pass to the location provider. Creates a new location provider for a Fleet Engine delivery vehicle. |

| ### Properties ||
|---|---|
| `deliveryVehicleId` | **Type:** `string` ID for the vehicle that this location provider observes. Set this field to track a vehicle. |
| `shouldShowOutcomeLocations` | **Type:** `boolean optional` Optionally allow users to display the task's outcome location. |
| `shouldShowTasks` | **Type:** `boolean optional` Optionally allow users to display fetched tasks. |
| `staleLocationThresholdMillis` | **Type:** `number` This Field is read-only. Threshold for stale vehicle location. If the last updated location for the vehicle is older than this threshold, the vehicle will not be displayed. |
| `taskFilterOptions` | **Type:** `FleetEngineTaskFilterOptions` Returns the filter options to apply when fetching tasks. |

| ### Methods ||
|---|---|

| ### Events ||
|---|---|
| `error` | `function(event)` **Arguments:** - `event: ErrorEvent` Event that is triggered when the location provider encounters an error. |
| `update` | `function(event)` **Arguments:** - `event: FleetEngineDeliveryVehicleLocationProviderUpdateEvent` Event that is triggered when a Fleet Engine data update request has finished. |

## [FleetEngineDeliveryVehicleLocationProviderOptions](https://developers.google.com/maps/documentation/javascript/reference/journey-sharing-fleet-tracking.md.txt#FleetEngineDeliveryVehicleLocationProviderOptions)
interface


interface
`google.maps.journeySharing.FleetEngineDeliveryVehicleLocationProviderOptions`

Options for delivery vehicle location provider.

| ### Properties ||
|---|---|
| `authTokenFetcher` | **Type:** `AuthTokenFetcher` Provides JSON Web Tokens for authenticating the client to Fleet Engine. |
| `projectId` | **Type:** `string` The consumer's project ID from Google Cloud Console. |
| `activePolylineCustomization` optional | **Type:** `(function(DeliveryVehiclePolylineCustomizationFunctionParams): void)|PolylineOptions optional` Customization applied to the active polyline. An active polyline corresponds to a portion of the route the vehicle is currently traversing through. Use this field to specify custom styling (such as polyline color) and interactivity (such as click handling). - If a `PolylineOptions` object is specified, the changes specified in it are applied to the polyline after the polyline has been created, overwriting its default options if they exist. - If a function is specified, it is invoked once when the polyline is created. (On this invocation, the `isNew` parameter in the function parameters object is set to `true`.) Additionally, this function is invoked when the polyline's coordinates change, or when the location provider receives data from Fleet Engine, regardless of whether the data corresponding to this polyline have changed. See `DeliveryVehiclePolylineCustomizationFunctionParams` for a list of supplied parameters and their uses. |
| `deliveryVehicleId` optional | **Type:** `string optional` The delivery vehicle ID to track immediately after the location provider is instantiated. If not specified, the location provider does not start tracking any vehicle; use `FleetEngineDeliveryVehicleLocationProvider.deliveryVehicleId` to set the ID and begin tracking. |
| `deliveryVehicleMarkerCustomization` optional | **Type:** `(function(DeliveryVehicleMarkerCustomizationFunctionParams): void)|MarkerOptions optional` Customization applied to the delivery vehicle marker. Use this field to specify custom styling (such as marker icon) and interactivity (such as click handling). - If a `MarkerOptions` object is specified, the changes specified in it are applied to the marker after the marker has been created, overwriting its default options if they exist. - If a function is specified, it is invoked once when the marker is created, before it is added to the map view. (On this invocation, the `isNew` parameter in the function parameters object is set to `true`.) Additionally, this function is invoked when the location provider receives data from Fleet Engine, regardless of whether the data corresponding to this marker have changed. See `DeliveryVehicleMarkerCustomizationFunctionParams` for a list of supplied parameters and their uses. |
| `plannedStopMarkerCustomization` optional | **Type:** `(function(PlannedStopMarkerCustomizationFunctionParams): void)|MarkerOptions optional` Customization applied to a planned stop marker. Use this field to specify custom styling (such as marker icon) and interactivity (such as click handling). - If a `MarkerOptions` object is specified, the changes specified in it are applied to the marker after the marker has been created, overwriting its default options if they exist. - If a function is specified, it is invoked once when the marker is created, before it is added to the map view. (On this invocation, the `isNew` parameter in the function parameters object is set to `true`.) Additionally, this function is invoked when the location provider receives data from Fleet Engine, regardless of whether the data corresponding to this marker have changed. See `PlannedStopMarkerCustomizationFunctionParams` for a list of supplied parameters and their uses. |
| `pollingIntervalMillis` optional | **Type:** `number optional` Minimum time between fetching location updates in milliseconds. If it takes longer than `pollingIntervalMillis` to fetch a location update, the next location update is not started until the current one finishes. Setting this value to 0 disables recurring location updates. A new location update is fetched if any of the parameters observed by the location provider changes. The default polling interval is 5000 milliseconds, the minimum interval. If you set the polling interval to a lower non-zero value, 5000 is used. |
| `remainingPolylineCustomization` optional | **Type:** `(function(DeliveryVehiclePolylineCustomizationFunctionParams): void)|PolylineOptions optional` Customization applied to the remaining polyline. A remaining polyline corresponds to a portion of the route the vehicle has not yet started traversing through. Use this field to specify custom styling (such as polyline color) and interactivity (such as click handling). - If a `PolylineOptions` object is specified, the changes specified in it are applied to the polyline after the polyline has been created, overwriting its default options if they exist. - If a function is specified, it is invoked once when the polyline is created. (On this invocation, the `isNew` parameter in the function parameters object is set to `true`.) Additionally, this function is invoked when the polyline's coordinates change, or when the location provider receives data from Fleet Engine, regardless of whether the data corresponding to this polyline have changed. See `DeliveryVehiclePolylineCustomizationFunctionParams` for a list of supplied parameters and their uses. |
| `shouldShowOutcomeLocations` optional | **Type:** `boolean optional` Boolean to show or hide outcome locations for the fetched tasks. |
| `shouldShowTasks` optional | **Type:** `boolean optional` Boolean to show or hide tasks. Setting this to false will prevent the ListTasks endpoint from being called to fetch the tasks. Only the upcoming vehicle stops will be displayed. |
| `staleLocationThresholdMillis` optional | **Type:** `number optional` Threshold for stale vehicle location. If the last updated location for the vehicle is older this threshold, the vehicle will not be displayed. Defaults to 24 hours in milliseconds. If the threshold is less than 0, or *Infinity*, the threshold will be ignored and the vehicle location will not be considered stale. |
| `takenPolylineCustomization` optional | **Type:** `(function(DeliveryVehiclePolylineCustomizationFunctionParams): void)|PolylineOptions optional` Customization applied to the taken polyline. A taken polyline corresponds to a portion of the route the vehicle has already traversed through. Use this field to specify custom styling (such as polyline color) and interactivity (such as click handling). - If a `PolylineOptions` object is specified, the changes specified in it are applied to the polyline after the polyline has been created, overwriting its default options if they exist. - If a function is specified, it is invoked once when the polyline is created. (On this invocation, the `isNew` parameter in the function parameters object is set to `true`.) Additionally, this function is invoked when the polyline's coordinates change, or when the location provider receives data from Fleet Engine, regardless of whether the data corresponding to this polyline have changed. See `DeliveryVehiclePolylineCustomizationFunctionParams` for a list of supplied parameters and their uses. |
| `taskFilterOptions` optional | **Type:** `FleetEngineTaskFilterOptions optional` Filter options to apply when fetching tasks. The options can include specific vehicle, time, and task status. |
| `taskMarkerCustomization` optional | **Type:** `(function(TaskMarkerCustomizationFunctionParams): void)|MarkerOptions optional` Customization applied to a task marker. A task marker is rendered at the planned location of each task assigned to the delivery vehicle. Use this field to specify custom styling (such as marker icon) and interactivity (such as click handling). - If a `MarkerOptions` object is specified, the changes specified in it are applied to the marker after the marker has been created, overwriting its default options if they exist. - If a function is specified, it is invoked once when the marker is created, before it is added to the map view. (On this invocation, the `isNew` parameter in the function parameters object is set to `true`.) Additionally, this function is invoked when the location provider receives data from Fleet Engine, regardless of whether the data corresponding to this marker have changed. See `TaskMarkerCustomizationFunctionParams` for a list of supplied parameters and their uses. |
| `taskOutcomeMarkerCustomization` optional | **Type:** `function(TaskMarkerCustomizationFunctionParams): void optional` Customization applied to a task outcome marker. A task outcome marker is rendered at the actual outcome location of each task assigned to the delivery vehicle. Use this field to specify custom styling (such as marker icon) and interactivity (such as click handling). - If a `MarkerOptions` object is specified, the changes specified in it are applied to the marker after the marker has been created, overwriting its default options if they exist. - If a function is specified, it is invoked once when the marker is created, before it is added to the map view. (On this invocation, the `isNew` parameter in the function parameters object is set to `true`.) Additionally, this function is invoked when the location provider receives data from Fleet Engine, regardless of whether the data corresponding to this marker have changed. See `TaskMarkerCustomizationFunctionParams` for a list of supplied parameters and their uses. |

## [FleetEngineTaskFilterOptions](https://developers.google.com/maps/documentation/javascript/reference/journey-sharing-fleet-tracking.md.txt#FleetEngineTaskFilterOptions)
interface


interface
`google.maps.journeySharing.FleetEngineTaskFilterOptions`

Filtering options for tasks in the Delivery Vehicle Location Provider.

| ### Properties ||
|---|---|
| `completionTimeFrom` optional | **Type:** `Date optional` Exclusive lower bound for the completion time of the task. Used to filter for tasks that were completed after the specified time. |
| `completionTimeTo` optional | **Type:** `Date optional` Exclusive upper bound for the completion time of the task. Used to filter for tasks that were completed before the specified time. |
| `state` optional | **Type:** `string optional` The state of the task. Valid values are OPEN or CLOSED. |

## [FleetEngineDeliveryVehicleLocationProviderUpdateEvent](https://developers.google.com/maps/documentation/javascript/reference/journey-sharing-fleet-tracking.md.txt#FleetEngineDeliveryVehicleLocationProviderUpdateEvent)
interface


interface
`google.maps.journeySharing.FleetEngineDeliveryVehicleLocationProviderUpdateEvent`

The event object passed to the event handler when the `FleetEngineDeliveryVehicleLocationProvider.update` event is triggered.

| ### Properties ||
|---|---|
| `completedVehicleJourneySegments` optional | **Type:** `Array<VehicleJourneySegment> optional` The journey segments that have been completed by this vehicle. Unmodifiable. |
| `deliveryVehicle` optional | **Type:** `DeliveryVehicle optional` The delivery vehicle data structure returned by the update. Unmodifiable. |
| `tasks` optional | **Type:** `Array<Task> optional` The list of tasks served by this delivery vehicle. Unmodifiable. |

## [FleetEngineDeliveryFleetLocationProvider](https://developers.google.com/maps/documentation/javascript/reference/journey-sharing-fleet-tracking.md.txt#FleetEngineDeliveryFleetLocationProvider)
class


class
`google.maps.journeySharing.FleetEngineDeliveryFleetLocationProvider`
extends `PollingLocationProvider, LocationProvider`

library `"journeySharing"`

Delivery Fleet Location Provider.

```javascript
const {FleetEngineDeliveryFleetLocationProvider} = await google.maps.importLibrary("journeySharing");
```

| ### Constructor ||
|---|---|
| `FleetEngineDeliveryFleetLocationProvider` | `FleetEngineDeliveryFleetLocationProvider(options)` **Parameters:** - `options: FleetEngineDeliveryFleetLocationProviderOptions` Options to pass to the location provider. Creates a new location provider for vehicles tracked by Fleet Engine. |

| ### Properties ||
|---|---|
| `deliveryVehicleFilter` | **Type:** `string optional` The filter applied when fetching the delivery vehicles. |
| `locationRestriction` | **Type:** `LatLngBounds|LatLngBoundsLiteral optional` The bounds within which to track delivery vehicles. If no bounds are set, no delivery vehicles will be tracked. To track all delivery vehicles regardless of location, set bounds equivalent to the entire earth. |
| `staleLocationThresholdMillis` | **Type:** `number` This Field is read-only. Threshold for stale vehicle location. If the last updated location for the vehicle is older than this threshold, the vehicle will not be displayed. |

| ### Methods ||
|---|---|

| ### Events ||
|---|---|
| `update` | `function(event)` **Arguments:** - `event: FleetEngineDeliveryFleetLocationProviderUpdateEvent` Event that is triggered when a Fleet Engine data update request has finished. |

## [FleetEngineDeliveryFleetLocationProviderOptions](https://developers.google.com/maps/documentation/javascript/reference/journey-sharing-fleet-tracking.md.txt#FleetEngineDeliveryFleetLocationProviderOptions)
interface


interface
`google.maps.journeySharing.FleetEngineDeliveryFleetLocationProviderOptions`

Options for delivery fleet location provider.

| ### Properties ||
|---|---|
| `authTokenFetcher` | **Type:** `AuthTokenFetcher` Provides JSON Web Tokens for authenticating the client to Fleet Engine. |
| `projectId` | **Type:** `string` The consumer's project ID from Google Cloud Console. |
| `deliveryVehicleFilter` optional | **Type:** `string optional` A filter query to apply when fetching delivery vehicles. This filter is passed directly to Fleet Engine. See [ListDeliveryVehiclesRequest.filter](https://goo.gle/3wT0Dlt) for supported formats. Note that valid filters for attributes must have the "attributes" prefix. For example, `attributes.x = "y"` or `attributes."x y" = "z"`. |
| `deliveryVehicleMarkerCustomization` optional | **Type:** `function(DeliveryVehicleMarkerCustomizationFunctionParams): void optional` Customization applied to a delivery vehicle marker. Use this field to specify custom styling (such as marker icon) and interactivity (such as click handling). - If a `MarkerOptions` object is specified, the changes specified in it are applied to the marker after the marker has been created, overwriting its default options if they exist. - If a function is specified, it is invoked once when the marker is created, before it is added to the map view. (On this invocation, the `isNew` parameter in the function parameters object is set to `true`.) Additionally, this function is invoked when the location provider receives data from Fleet Engine, regardless of whether the data corresponding to this marker have changed. See `DeliveryVehicleMarkerCustomizationFunctionParams` for a list of supplied parameters and their uses. |
| `locationRestriction` optional | **Type:** `LatLngBounds|LatLngBoundsLiteral optional` The latitude/longitude bounds within which to track vehicles immediately after the location provider is instantiated. If not set, the location provider does not start tracking any vehicles; use `FleetEngineDeliveryFleetLocationProvider.locationRestriction` to set the bounds and begin tracking. To track all delivery vehicles regardless of location, set bounds equivalent to the entire earth. |
| `staleLocationThresholdMillis` optional | **Type:** `number optional` Threshold for stale vehicle location. If the last updated location for the vehicle is older this threshold, the vehicle will not be displayed. Defaults to 24 hours in milliseconds. If the threshold is less than zero, or *Infinity*, the threshold will be ignored and the vehicle location will not be considered stale. |

## [FleetEngineDeliveryFleetLocationProviderUpdateEvent](https://developers.google.com/maps/documentation/javascript/reference/journey-sharing-fleet-tracking.md.txt#FleetEngineDeliveryFleetLocationProviderUpdateEvent)
interface


interface
`google.maps.journeySharing.FleetEngineDeliveryFleetLocationProviderUpdateEvent`

The event object passed to the event handler when the `FleetEngineDeliveryFleetLocationProvider.update` event is triggered.

| ### Properties ||
|---|---|
| `deliveryVehicles` optional | **Type:** `Array<DeliveryVehicle> optional` The list of delivery vehicles returned by the query. Unmodifiable. |