GoogleRidesharingDriver Framework Reference
Stay organized with collections
Save and categorize content based on your preferences.
GMTDVehicleReporter
@interface GMTDVehicleReporter
: NSObject <GMSNavigatorListener, GMSRoadSnappedLocationProviderListener>
Object for sending information to the Fleet Engine backend.
Use this class only from the main thread.
-
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.
Parameters
vehicleState
|
The desired vehicle state.
|
-
Adds a listener. The listener is held with a weak reference.
-
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-01-21 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-01-21 UTC."],[[["\u003cp\u003e\u003ccode\u003eGMTDVehicleReporter\u003c/code\u003e is an object for sending information to the Fleet Engine backend and should only be used from the main thread.\u003c/p\u003e\n"],["\u003cp\u003eLocation tracking can be enabled or disabled with \u003ccode\u003elocationTrackingEnabled\u003c/code\u003e, and when disabled, the vehicle state is set to \u003ccode\u003eGMTDVehicleStateOffline\u003c/code\u003e in the Fleet Engine.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003elocationReportingInterval\u003c/code\u003e defines the minimum frequency of location reports sent to Fleet Engine, with a supported range between 5 and 60 seconds.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eupdateVehicleState\u003c/code\u003e method is used for ridesharing to change the vehicle state, requiring monitoring for success or failure, and will fail when \u003ccode\u003elocationTrackingEnabled\u003c/code\u003e is set to \u003ccode\u003eNO\u003c/code\u003e when setting the state to online.\u003c/p\u003e\n"],["\u003cp\u003eListeners can be added and removed to receive updates by using \u003ccode\u003eaddListener:\u003c/code\u003e and \u003ccode\u003eremoveListener:\u003c/code\u003e, respectively, with the listeners required to conform to the \u003ccode\u003eGMTDVehicleReporterListener\u003c/code\u003e protocol.\u003c/p\u003e\n"]]],[],null,["GMTDVehicleReporter \n\n @interface GMTDVehicleReporter\n : NSObject \u003cGMSNavigatorListener, GMSRoadSnappedLocationProviderListener\u003e\n\nObject for sending information to the Fleet Engine backend.\n\nUse this class only from the main thread.\n- `\n ``\n ``\n `\n\n [-init](#/c:objc(cs)GMTDVehicleReporter(im)init)`\n ` \n Unavailable \n This class has no public initializers; obtain this object from the `vehicleReporter` property\n of the `GMTDDeliveryDriverAPI` or [GMTDRidesharingDriverAPI](../Classes/GMTDRidesharingDriverAPI.html) object. \n\n Declaration \n Objective-C \n\n - (null_unspecified instancetype)init;\n\n- `\n ``\n ``\n `\n\n [locationTrackingEnabled](#/c:objc(cs)GMTDVehicleReporter(py)locationTrackingEnabled)`\n ` \n Indicates whether location tracking is enabled.\n\n If set to YES, trip and vehicle updates are sent to the Fleet Engine backend at a regular\n interval based on the value set for `locationUpdateInterval`.\n\n If set to NO, updates stop and a one-off vehicle update request is sent to the Fleet Engine\n backend to set the vehicle state to `GMTDVehicleStateOffline`. See `updateVehicleState`\n for special considerations on handling failures when `locationTrackingEnabled` is set to NO. \n\n Declaration \n Swift \n\n var locationTrackingEnabled: Bool { get set }\n\n Objective-C \n\n @property (nonatomic) BOOL locationTrackingEnabled;\n\n- `\n ``\n ``\n `\n\n [locationReportingInterval](#/c:objc(cs)GMTDVehicleReporter(py)locationReportingInterval)`\n ` \n Indicates the minimum interval at which location reports will be delivered to Fleet Engine.\n\n NOTE: The default reporting interval is 10 seconds. The maximum supported value is 60 seconds\n and the minimum supported value is 5 seconds. If a value outside of this range is used, the\n requested value is clamped to that range. \n\n Declaration \n Swift \n\n var locationReportingInterval: TimeInterval { get set }\n\n Objective-C \n\n @property (nonatomic) NSTimeInterval locationReportingInterval;\n\n- `\n ``\n ``\n `\n\n [-updateVehicleState:](#/c:objc(cs)GMTDVehicleReporter(im)updateVehicleState:)`\n ` \n Updates the vehicle state. Used only for ridesharing.\n\n If [locationTrackingEnabled](../Classes/GMTDVehicleReporter.html#/c:objc(cs)GMTDVehicleReporter(py)locationTrackingEnabled) is set to NO, setting the state to `GMTDVehicleStateOnline` fails.\n\n Setting a different state will send a one-off request to the Fleet Engine backend.\n\n This method updates a server-side state, the client app should monitor\n `-fleetEngine:didSucceedVehicleUpdate:` and `-fleetEngine:didFailVehicleUpdate:withError:`\n to confirm success or failure. Failures are retried automatically if\n [locationTrackingEnabled](../Classes/GMTDVehicleReporter.html#/c:objc(cs)GMTDVehicleReporter(py)locationTrackingEnabled) is set to YES. \n\n Declaration \n Swift \n\n func update(_ vehicleState: ../Enums/GMTDVehicleState.html)\n\n Objective-C \n\n - (void)updateVehicleState:(../Enums/GMTDVehicleState.html)vehicleState;\n\n Parameters\n\n |----------------------|----------------------------|\n | ` `*vehicleState*` ` | The desired vehicle state. |\n\n- `\n ``\n ``\n `\n\n [-addListener:](#/c:objc(cs)GMTDVehicleReporter(im)addListener:)`\n ` \n Adds a listener. The listener is held with a weak reference. \n\n Declaration \n Swift \n\n func add(_ listener: any ../Protocols/GMTDVehicleReporterListener.html)\n\n Objective-C \n\n - (void)addListener:(nonnull id\u003c../Protocols/GMTDVehicleReporterListener.html\u003e)listener;\n\n Parameters\n\n |------------------|--------------------------------------------------------------------------------------------------------------------|\n | ` `*listener*` ` | An object conforming to the [GMTDVehicleReporterListener](../Protocols/GMTDVehicleReporterListener.html) protocol. |\n\n- `\n ``\n ``\n `\n\n [-removeListener:](#/c:objc(cs)GMTDVehicleReporter(im)removeListener:)`\n ` \n Removes a listener. \n\n Declaration \n Swift \n\n func remove(_ listener: any ../Protocols/GMTDVehicleReporterListener.html)\n\n Objective-C \n\n - (void)removeListener:(nonnull id\u003c../Protocols/GMTDVehicleReporterListener.html\u003e)listener;\n\n Parameters\n\n |------------------|--------------------------------------------------------------------------------------------------------------------|\n | ` `*listener*` ` | An object conforming to the [GMTDVehicleReporterListener](../Protocols/GMTDVehicleReporterListener.html) protocol. |"]]