VehicleRouteOverview

public interface VehicleRouteOverview

A VehicleRouteOverview is an object you use to retrieve information about the current route for a delivery vehicle. The object contains the provider and vehicle bindings necessary for this operation. A given VehicleRouteOverview instance may contain only one vehicle/provider pair, tracked by their IDs.

There is only one vehicle/provider pair (tracked by their IDs) per VehicleRouteOverview instance.

All methods are guaranteed to be thread-safe.

Public Method Summary

abstract void
addOnRouteChangedEventListener(OnRouteChangedListener listener)
Registers a listener for a change to the route for the registered vehicle.
abstract void
cleanUp()
Clears internal state and unregisters event listeners.
abstract void
clearEventListeners()
Unregisters all user-defined event listeners on Route Overview.
abstract ListenableFuture<ImmutableList<RouteToVehicleStop>>
getRouteToVehicleStops()
Returns the list of remaining vehicle routes.
abstract void
abstract void
setRouteOverviewEnabled(boolean isEnabled)
Enables or disables the route overview feature.

Public Methods

public abstract void addOnRouteChangedEventListener (OnRouteChangedListener listener)

Registers a listener for a change to the route for the registered vehicle.

A route change event occurs whenever the path to any of the stops assigned to vehicle is updated, OR the stops order is rearranged, OR there are updates on the ETA information.

Note: In order to avoid memory leaks, use removeOnRouteChangedEventListener(OnRouteChangedListener) to remove a listener that is no longer required.

Parameters
listener the listener to be registered. Must not be null.

public abstract void clearEventListeners ()

Unregisters all user-defined event listeners on Route Overview.

Note: This method only cleans up the event listeners pool. It does not turn stop Route Overview to continue retrieving route updates. In order to disable the feature, use setRouteOverviewEnabled(boolean) to determine if it should be enabled or not.

public abstract ListenableFuture<ImmutableList<RouteToVehicleStop>> getRouteToVehicleStops ()

Returns the list of remaining vehicle routes. If there are no routes available to the vehicle, returns an empty list.

Note: that this method returns a snapshot of the list at a certain point in time. For recurring route updates, refer to the events API.

public abstract void removeOnRouteChangedEventListener (OnRouteChangedListener listener)

Removes a route changed event listener added via addOnRouteChangedEventListener(OnRouteChangedListener).

Parameters
listener a listener added via addOnRouteChangedEventListener(OnRouteChangedListener)

public abstract void setRouteOverviewEnabled (boolean isEnabled)

Enables or disables the route overview feature. If enabled, route data will continually be provided to registered listeners.

Parameters
isEnabled determines whether route overview is enabled or disabled.