GoogleRidesharingConsumer Framework Reference

  • The GMTCServices class is the main service class for the Google Consumer Ridesharing SDK for iOS, providing access to the GMTCTripService.

  • Before using any other method, initialize the SDK by calling setAccessTokenProvider:providerID: with a valid GMTCAuthorization implementation and a Google Cloud Project ID.

  • The sharedServices method returns a shared instance of GMTCServices, but it will throw an exception if setAccessTokenProvider: has not been called first.

  • Retrieve the current SDK version using SDKVersion or SDKLongVersion, which provides detailed release information.

  • Enable or disable the reporting of abnormal SDK terminations using setAbnormalTerminationReportingEnabled:, which is set to YES by default and must be called before sharedServices.

GMTCServices

@interface GMTCServices : NSObject

Service class for the Google Consumer Ridesharing SDK for iOS.

  • Return an instance of the GMTCTripService.

    Declaration

    Swift

    var tripService: GMTCTripService { get }

    Objective-C

    @property (nonatomic, readonly) GMTCTripService *_Nonnull tripService;
  • Main Rodesharing SDK init method. Should be called before any other method.

    Declaration

    Swift

    class func setAccessTokenProvider(_ accessTokenProvider: any GMTCAuthorization, providerID: String)

    Objective-C

    + (void)setAccessTokenProvider:
                (nonnull id<GMTCAuthorization>)accessTokenProvider
                        providerID:(nonnull NSString *)providerID;

    Parameters

    accessTokenProvider

    An implementation of GMTCAuthorization, which can provide a valid access token.

    providerID

    An ID of the Google Cloud Project (e.g. sample-consumer-project).

  • Provides the shared instance of GMTCServices for the Google Ridesharing SDK for iOS. Ridesharing classes will hold this instance to provide their connection to Google.

    This method will throw an exception if +setAccessTokenProvider: has not been called.

    Declaration

    Swift

    class func shared() -> Self

    Objective-C

    + (nonnull instancetype)sharedServices;
  • Returns the version for this release of the Google Ridesharing SDK for iOS. For example, “0.4.4”. The version number is in the SDK’s resource bundle.

    Declaration

    Swift

    class func sdkVersion() -> String

    Objective-C

    + (nonnull NSString *)SDKVersion;
  • Returns the long formatted version of the string. It includes the version string and bundle version in format “ ()”. For example, “0.4.4 (234.2)”.

    Declaration

    Swift

    class func sdkLongVersion() -> String

    Objective-C

    + (nonnull NSString *)SDKLongVersion;
  • Enables reporting of abnormal SDK terminations such as when the app crashes while the SDK is still running. This allows Google to improve SDK stability when applicable. The default is YES and value must be updated before the sharedServices is called.

    This property must be set from the main thread.

    Declaration

    Swift

    class func setAbnormalTerminationReportingEnabled(_ abnormalTerminationReportingEnabled: Bool)

    Objective-C

    + (void)setAbnormalTerminationReportingEnabled:
        (BOOL)abnormalTerminationReportingEnabled;