GoogleRidesharingDriver Framework Reference

  • GMTDVehicleReporter is an object for sending information to the Fleet Engine backend and should only be used from the main thread.

  • Location tracking can be enabled or disabled with locationTrackingEnabled, and when disabled, the vehicle state is set to GMTDVehicleStateOffline in the Fleet Engine.

  • locationReportingInterval defines the minimum frequency of location reports sent to Fleet Engine, with a supported range between 5 and 60 seconds.

  • The updateVehicleState method is used for ridesharing to change the vehicle state, requiring monitoring for success or failure, and will fail when locationTrackingEnabled is set to NO when setting the state to online.

  • Listeners can be added and removed to receive updates by using addListener: and removeListener:, respectively, with the listeners required to conform to the GMTDVehicleReporterListener protocol.

GMTDVehicleReporter

@interface GMTDVehicleReporter
    : NSObject <GMSNavigatorListener, GMSRoadSnappedLocationProviderListener>

Object for sending information to the Fleet Engine backend.

Use this class only from the main thread.

  • Unavailable

    This class has no public initializers; obtain this object from the vehicleReporter property of the GMTDDeliveryDriverAPI or GMTDRidesharingDriverAPI object.

    Declaration

    Objective-C

    - (null_unspecified instancetype)init;
  • Indicates whether location tracking is enabled.

    If set to YES, trip and vehicle updates are sent to the Fleet Engine backend at a regular interval based on the value set for locationUpdateInterval.

    If set to NO, updates stop and a one-off vehicle update request is sent to the Fleet Engine backend to set the vehicle state to GMTDVehicleStateOffline. See updateVehicleState for special considerations on handling failures when locationTrackingEnabled is set to NO.

    Declaration

    Swift

    var locationTrackingEnabled: Bool { get set }

    Objective-C

    @property (nonatomic) BOOL locationTrackingEnabled;
  • Indicates the minimum interval at which location reports will be delivered to Fleet Engine.

    NOTE: The default reporting interval is 10 seconds. The maximum supported value is 60 seconds and the minimum supported value is 5 seconds. If a value outside of this range is used, the requested value is clamped to that range.

    Declaration

    Swift

    var locationReportingInterval: TimeInterval { get set }

    Objective-C

    @property (nonatomic) NSTimeInterval locationReportingInterval;
  • Updates the vehicle state. Used only for ridesharing.

    If locationTrackingEnabled is set to NO, setting the state to GMTDVehicleStateOnline fails.

    Setting a different state will send a one-off request to the Fleet Engine backend.

    This method updates a server-side state, the client app should monitor -fleetEngine:didSucceedVehicleUpdate: and -fleetEngine:didFailVehicleUpdate:withError: to confirm success or failure. Failures are retried automatically if locationTrackingEnabled is set to YES.

    Declaration

    Swift

    func update(_ vehicleState: GMTDVehicleState)

    Objective-C

    - (void)updateVehicleState:(GMTDVehicleState)vehicleState;

    Parameters

    vehicleState

    The desired vehicle state.

  • Adds a listener. The listener is held with a weak reference.

    Declaration

    Swift

    func add(_ listener: any GMTDVehicleReporterListener)

    Objective-C

    - (void)addListener:(nonnull id<GMTDVehicleReporterListener>)listener;

    Parameters

    listener

    An object conforming to the GMTDVehicleReporterListener protocol.

  • Removes a listener.

    Declaration

    Swift

    func remove(_ listener: any GMTDVehicleReporterListener)

    Objective-C

    - (void)removeListener:(nonnull id<GMTDVehicleReporterListener>)listener;

    Parameters

    listener

    An object conforming to the GMTDVehicleReporterListener protocol.