Initialize the Driver SDK

  • To initiate vehicle updates to Fleet Engine and the customer backend, create a GMTDDeliveryDriverAPI instance.

  • This instance requires your Google Cloud Project ID (providerID), vehicleID, driverContext, and accessTokenProvider.

  • An Objective-C code example demonstrates the creation of a GMTDDeliveryDriverAPI instance using these parameters.

  • For setup instructions of your Google Cloud Project, refer to the provided documentation link.

  • The next step involves getting the vehicle ready, as detailed in the provided link.

To start sending vehicle updates to Fleet Engine and the customer backend, create a GMTDDeliveryDriverAPI instance that includes the providerID, vehicleID, driverContext, and accessTokenProvider.

The providerID is the same as the Project ID of your Google Cloud Project. For information on setting up the Google Cloud Project, see Create your Fleet Engine project.

The following example shows how to create a GMTDDeliveryDriverAPI instance.

Objective-C

#import "SampleViewController.h"
#import "SampleAccessTokenProvider.h"
#import <GoogleRidesharingDriver/GoogleRidesharingDriver.h>

static NSString *const PROVIDER_ID = @"INSERT_YOUR_PROVIDER_ID";

@implementation SampleViewController {
 GMSMapView *_mapView;
}

- (void)viewDidLoad {
  NSString *vehicleID = @"INSERT_CREATED_VEHICLE_ID";
  SampleAccessTokenProvider *accessTokenProvider =
                                [[SampleAccessTokenProvider alloc] init];
  GMTDDriverContext *driverContext =
     [[GMTDDriverContext alloc] initWithAccessTokenProvider:accessTokenProvider
                                                 providerID:PROVIDER_ID
                                                   vehicleID:vehicleID
                                                   navigator:_mapView.navigator];

  GMTDDeliveryDriverAPI *deliveryDriverAPI = [[GMTDDeliveryDriverAPI alloc] initWithDriverContext:driverContext];
}

What's next

Get the vehicle ready