GMSNavigationTransactionRecorder
@interface GMSNavigationTransactionRecorder : NSObject
Contains methods for recording transactions. This class should only be used if you are a Mobility Services customer and are billed by Google on a per-transaction basis.
-
Returns a shared singleton
GMSNavigationTransactionRecorder
instance. This singleton is held weakly and may be deallocated if an application does not keep a strong reference. You must call this function only on the main thread.This method will throw an exception if
GMSServices
+provideAPIKey:
has not been called.Declaration
Swift
class func sharedInstance() -> GMSNavigationTransactionRecorder
Objective-C
+ (nonnull GMSNavigationTransactionRecorder *)sharedInstance;
-
You should call this function each time a passenger or a delivery is picked up. You should populate the transactionIDs parameter with a unique ID for each transaction that applies to this event. You must call this function only on the main thread.
This method should be called if and only if your company is billed by Google on a per-transaction basis.
Declaration
Swift
func recordPickup(at waypoint: GMSNavigationWaypoint?, forTransactionIDs transactionIDs: [String], withErrorHandler errorHandler: GMSNavigationTransactionRecorderErrorHandler? = nil)
Objective-C
- (void)recordPickupAtWaypoint:(nullable GMSNavigationWaypoint *)waypoint forTransactionIDs:(nonnull NSArray<NSString *> *)transactionIDs withErrorHandler: (nullable GMSNavigationTransactionRecorderErrorHandler) errorHandler;
Parameters
waypoint
The
GMSNavigationWaypoint
at which the pickup is occurring, or nil if there was no guidance session leading to this pickup.transactionIDs
One or more transaction IDs to which this pickup applies. The transaction ID must be unique for each billable transaction. Transaction IDs must contain at least one and at most 64 characters.
errorHandler
A block that will be invoked asynchronously on the main thread if an error occurs while recording the pickup.
-
You should call this function each time a passenger is dropped-off or a delivery is delivered. You should populate the transactionIDs parameter with a unique ID for each transaction that applies to this event. You must call this function only on the main thread.
This method should be called if and only if your company is billed by Google on a per-transaction basis.
Declaration
Swift
func recordDropoff(at waypoint: GMSNavigationWaypoint?, forTransactionIDs transactionIDs: [String], withErrorHandler errorHandler: GMSNavigationTransactionRecorderErrorHandler? = nil)
Objective-C
- (void)recordDropoffAtWaypoint:(nullable GMSNavigationWaypoint *)waypoint forTransactionIDs:(nonnull NSArray<NSString *> *)transactionIDs withErrorHandler: (nullable GMSNavigationTransactionRecorderErrorHandler) errorHandler;
Parameters
waypoint
The
GMSNavigationWaypoint
at which the dropoff is occurring, or nil if there was no guidance session leading to this dropoff.transactionIDs
One or more transaction IDs to which this dropoff applies. The transaction ID must be unique for each billable transaction. Transaction IDs must contain at least one and at most 64 characters.
errorHandler
A block that will be invoked asynchronously on the main thread if an error occurs while recording the dropoff.
-
Generate a new unique transaction ID.
Declaration
Swift
class func generateTransactionID() -> String
Objective-C
+ (nonnull NSString *)generateTransactionID;
-
Unavailable
Init is unavailable. Use +sharedInstance to acquire an instance.
Declaration
Objective-C
- (nonnull instancetype)init;