Inicializar o SDK do Driver
Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Para começar a enviar atualizações de veículo ao Fleet Engine e ao back-end do cliente, crie uma instância GMTDDeliveryDriverAPI
que inclua providerID
, vehicleID
, driverContext
e accessTokenProvider
.
O providerID
é o mesmo que o ID do projeto do seu projeto do Google Cloud. Para informações sobre como configurar o projeto do Google Cloud, consulte
Criar seu projeto do Fleet Engine.
O exemplo a seguir mostra como criar uma instância 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];
}
A seguir
Prepare o veículo
Exceto em caso de indicação contrária, o conteúdo desta página é licenciado de acordo com a Licença de atribuição 4.0 do Creative Commons, e as amostras de código são licenciadas de acordo com a Licença Apache 2.0. Para mais detalhes, consulte as políticas do site do Google Developers. Java é uma marca registrada da Oracle e/ou afiliadas.
Última atualização 2025-08-31 UTC.
[null,null,["Última atualização 2025-08-31 UTC."],[[["\u003cp\u003eTo initiate vehicle updates to Fleet Engine and the customer backend, create a \u003ccode\u003eGMTDDeliveryDriverAPI\u003c/code\u003e instance.\u003c/p\u003e\n"],["\u003cp\u003eThis instance requires your Google Cloud Project ID (\u003ccode\u003eproviderID\u003c/code\u003e), \u003ccode\u003evehicleID\u003c/code\u003e, \u003ccode\u003edriverContext\u003c/code\u003e, and \u003ccode\u003eaccessTokenProvider\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eAn Objective-C code example demonstrates the creation of a \u003ccode\u003eGMTDDeliveryDriverAPI\u003c/code\u003e instance using these parameters.\u003c/p\u003e\n"],["\u003cp\u003eFor setup instructions of your Google Cloud Project, refer to the provided documentation link.\u003c/p\u003e\n"],["\u003cp\u003eThe next step involves getting the vehicle ready, as detailed in the provided link.\u003c/p\u003e\n"]]],[],null,["# Initialize the Driver SDK\n\nTo start sending vehicle updates to Fleet Engine and the customer backend,\ncreate a `GMTDDeliveryDriverAPI` instance that includes the\n`providerID`, `vehicleID`, `driverContext`, and `accessTokenProvider`.\n\nThe `providerID` is the same as the **Project ID** of your Google Cloud\nProject. For information on setting up the Google Cloud Project, see\n[Create your Fleet Engine project](/maps/documentation/mobility/fleet-engine/essentials/set-up-fleet/create-project).\n\nThe following example shows how to create a `GMTDDeliveryDriverAPI` instance. \n\n### Objective-C\n\n #import \"SampleViewController.h\"\n #import \"SampleAccessTokenProvider.h\"\n #import \u003cGoogleRidesharingDriver/GoogleRidesharingDriver.h\u003e\n\n static NSString *const PROVIDER_ID = @\"INSERT_YOUR_PROVIDER_ID\";\n\n @implementation SampleViewController {\n GMSMapView *_mapView;\n }\n\n - (void)viewDidLoad {\n NSString *vehicleID = @\"INSERT_CREATED_VEHICLE_ID\";\n SampleAccessTokenProvider *accessTokenProvider =\n [[SampleAccessTokenProvider alloc] init];\n GMTDDriverContext *driverContext =\n [[GMTDDriverContext alloc] initWithAccessTokenProvider:accessTokenProvider\n providerID:PROVIDER_ID\n vehicleID:vehicleID\n navigator:_mapView.navigator];\n\n GMTDDeliveryDriverAPI *deliveryDriverAPI = [[GMTDDeliveryDriverAPI alloc] initWithDriverContext:driverContext];\n }\n\nWhat's next\n-----------\n\n[Get the vehicle ready](/maps/documentation/mobility/driver-sdk/scheduled/ios/vehicle-ready)"]]