Inizializza l'SDK Driver

Per iniziare a inviare aggiornamenti del veicolo a Fleet Engine e al backend del cliente, crea un'istanza GMTDDeliveryDriverAPI che include providerID, vehicleID, driverContext e accessTokenProvider.

Il providerID è uguale all'ID progetto del tuo account Google Cloud progetto. Per informazioni sulla configurazione del progetto Google Cloud, consulta Crea il tuo progetto Fleet Engine.

L'esempio seguente mostra come creare un'istanza GMTDDeliveryDriverAPI.

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];
}

Passaggi successivi

Prepara il veicolo