GoogleRidesharingConsumer Framework Reference
Stay organized with collections
Save and categorize content based on your preferences.
GMTCTripService
@interface GMTCTripService : NSObject
Provides methods for accessing trip session(s).
-
Creates and returns an instance of GMTCTripModel
by the given trip name.
If a trip session instance has already been created for the given trip name, then that instance
will be returned.
The instance of the TripModel created or retrieved can be configured via the sessionOptions
of GMTCTripModel
. Usually this sessionOptions
property can be used to adjust the refresh time
interval between the repeated trip info polling. see the comment in the class
GMTCTripModelOptions
for more details.
Declaration
Swift
func tripModel(forTripName tripName: String) -> GMTCTripModel?
Objective-C
- (nullable GMTCTripModel *)tripModelForTripName:(nonnull NSString *)tripName;
Parameters
tripName
|
The trip name for identifying a trip.
|
-
Returns whether there has been a trip session created by the GMTCTripService
.
Declaration
Swift
func hasTripModel(forTripName tripName: String) -> Bool
Objective-C
- (BOOL)hasTripModelForTripName:(nonnull NSString *)tripName;
Parameters
tripName
|
The trip name for identifying a trip.
|
-
Returns all the trip session objects created by this trip service.
-
Returns all the trip session objects created by this trip service which are actively running.
Declaration
Objective-C
- (nonnull NSArray<GMTCTripModel *> *)activeTripModels;
-
This class has no public initializers.
Declaration
Objective-C
- (null_unspecified instancetype)init;
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-08-27 UTC.
[null,null,["Last updated 2025-08-27 UTC."],[[["\u003cp\u003e\u003ccode\u003eGMTCTripService\u003c/code\u003e provides methods to access trip sessions, primarily through \u003ccode\u003eGMTCTripModel\u003c/code\u003e instances.\u003c/p\u003e\n"],["\u003cp\u003eYou can retrieve a \u003ccode\u003eGMTCTripModel\u003c/code\u003e instance for a specific trip name, reusing existing instances if they have already been created.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eGMTCTripService\u003c/code\u003e can determine if a \u003ccode\u003eGMTCTripModel\u003c/code\u003e instance exists for a given trip name, using the \u003ccode\u003ehasTripModelForTripName:\u003c/code\u003e method.\u003c/p\u003e\n"],["\u003cp\u003eYou can get all created trip session objects, or all actively running ones, using the \u003ccode\u003eallTripModels\u003c/code\u003e or \u003ccode\u003eactiveTripModels\u003c/code\u003e methods, respectively.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eGMTCTripService\u003c/code\u003e class does not have any public initializers, making direct initialization unavailable.\u003c/p\u003e\n"]]],[],null,["# GoogleRidesharingConsumer Framework Reference\n\nGMTCTripService\n===============\n\n @interface GMTCTripService : NSObject\n\nProvides methods for accessing trip session(s).\n- `\n ``\n ``\n `\n\n ### [-tripModelForTripName:](#/c:objc(cs)GMTCTripService(im)tripModelForTripName:)\n\n `\n ` \n Creates and returns an instance of [GMTCTripModel](../Classes/GMTCTripModel.html) by the given trip name.\n If a trip session instance has already been created for the given trip name, then that instance\n will be returned.\n The instance of the TripModel created or retrieved can be configured via the `sessionOptions`\n of [GMTCTripModel](../Classes/GMTCTripModel.html). Usually this `sessionOptions` property can be used to adjust the refresh time\n interval between the repeated trip info polling. see the comment in the class\n [GMTCTripModelOptions](../Classes/GMTCTripModelOptions.html) for more details. \n\n #### Declaration\n\n Swift \n\n func tripModel(forTripName tripName: String) -\u003e ../Classes/GMTCTripModel.html?\n\n Objective-C \n\n - (nullable ../Classes/GMTCTripModel.html *)tripModelForTripName:(nonnull NSString *)tripName;\n\n #### Parameters\n\n |------------------|---------------------------------------|\n | ` `*tripName*` ` | The trip name for identifying a trip. |\n\n- `\n ``\n ``\n `\n\n ### [-hasTripModelForTripName:](#/c:objc(cs)GMTCTripService(im)hasTripModelForTripName:)\n\n `\n ` \n Returns whether there has been a trip session created by the `GMTCTripService`. \n\n #### Declaration\n\n Swift \n\n func hasTripModel(forTripName tripName: String) -\u003e Bool\n\n Objective-C \n\n - (BOOL)hasTripModelForTripName:(nonnull NSString *)tripName;\n\n #### Parameters\n\n |------------------|---------------------------------------|\n | ` `*tripName*` ` | The trip name for identifying a trip. |\n\n- `\n ``\n ``\n `\n\n ### [-allTripModels](#/c:objc(cs)GMTCTripService(im)allTripModels)\n\n `\n ` \n Returns all the trip session objects created by this trip service. \n\n #### Declaration\n\n Swift \n\n func allTripModels() -\u003e [../Classes/GMTCTripModel.html]\n\n Objective-C \n\n - (nonnull NSArray\u003c../Classes/GMTCTripModel.html *\u003e *)allTripModels;\n\n- `\n ``\n ``\n `\n\n ### [-activeTripModels](#/c:objc(cs)GMTCTripService(im)activeTripModels)\n\n `\n ` \n Returns all the trip session objects created by this trip service which are actively running. \n\n #### Declaration\n\n Swift \n\n func activeTripModels() -\u003e [../Classes/GMTCTripModel.html]\n\n Objective-C \n\n - (nonnull NSArray\u003c../Classes/GMTCTripModel.html *\u003e *)activeTripModels;\n\n- `\n ``\n ``\n `\n\n ### [-init](#/c:objc(cs)GMTCTripService(im)init)\n\n `\n ` \n Unavailable \n This class has no public initializers. \n\n #### Declaration\n\n Objective-C \n\n - (null_unspecified instancetype)init;"]]