Initialize the Driver SDK

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