TripModel

public abstract class TripModel extends Trip
Known Direct Subclasses

Represents a specific trip. Used to register callbacks for trip data changes. The trip automatically updates in the background if active callbacks are registered.

Public Method Summary

final ConsumerTripOptions
getConsumerTripOptions()
This method is deprecated. use getTripModelOptions() instead.
TripInfo
getTripInfo()
Return TripInfo object containing information about the current trip.
TripModelOptions
getTripModelOptions()
Returns the current TripModelOptions set for this trip.
String
getTripName()
Gets the trip name.
boolean
isActive()
Returns whether TripModel is actively updating itself with fresh trip information from Fleet Engine.
boolean
isTripCallbackRegistered(TripModelCallback callback)
Returns whether this callback is registered.
void
registerTripCallback(LifecycleOwner lifecycleOwner, boolean updateInBackground, TripModelCallback callback)
Registers a callback to receive updates to this trip.
void
final void
void
setTripModelOptions(TripModelOptions options)
Sets TripModelOptions to configure this trip.
void

Inherited Method Summary

Public Methods

public final ConsumerTripOptions getConsumerTripOptions ()

This method is deprecated.
use getTripModelOptions() instead.

Returns the current ConsumerTripOptions set for this trip.

public TripInfo getTripInfo ()

Return TripInfo object containing information about the current trip.

public TripModelOptions getTripModelOptions ()

Returns the current TripModelOptions set for this trip.

public String getTripName ()

Gets the trip name.

Returns
  • The trip name string.

public boolean isActive ()

Returns whether TripModel is actively updating itself with fresh trip information from Fleet Engine. TripModel only refreshes if it has registered callbacks, so this will return false if TripModel has no callbacks registered.

public boolean isTripCallbackRegistered (TripModelCallback callback)

Returns whether this callback is registered.

public void registerTripCallback (LifecycleOwner lifecycleOwner, boolean updateInBackground, TripModelCallback callback)

Registers a callback to receive updates to this trip. Updates will be delivered on the main thread.

Parameters
lifecycleOwner The LifecycleOwner to monitor for the callback. The callback will automatically be unregistered when the LifecycleOwner is destroyed. Use setTripModelOptions(TripModelOptions) to set the refresh interval range.
updateInBackground Whether or not the callback should be called when the LifecycleOwner is in the background (paused). If this is false, the callback will only be called when the LifecycleOwner is in an active state (resumed).
callback The TripModelCallback to call when the trip changes.

public void registerTripCallback (TripModelCallback callback)

Similar to registerTripCallback(LifecycleOwner, boolean, TripModelCallback), but without monitoring a LifecycleOwner.

Parameters
callback The callback to call when the trip changes.

public final void setConsumerTripOptions (ConsumerTripOptions options)

This method is deprecated.
Use setTripModelOptions(TripModelOptions) instead.

Sets TripModelOptions to configure this trip.

public void setTripModelOptions (TripModelOptions options)

Sets TripModelOptions to configure this trip.

public void unregisterTripCallback (TripModelCallback callback)

Parameters
callback The callback to unregister.