Инициализируйте SDK драйвера
Оптимизируйте свои подборки
Сохраняйте и классифицируйте контент в соответствии со своими настройками.
Чтобы начать отправлять обновления данных о транспортных средствах в Fleet Engine и на серверную часть клиента, создайте экземпляр GMTDDeliveryDriverAPI
, включающий providerID
, vehicleID
, driverContext
и accessTokenProvider
.
Идентификатор providerID
совпадает с идентификатором вашего проекта Google Cloud. Сведения о настройке проекта Google Cloud см. в статье Создание проекта Fleet Engine .
В следующем примере показано, как создать экземпляр 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];
}
Что дальше?
Подготовьте автомобиль
Если не указано иное, контент на этой странице предоставляется по лицензии Creative Commons "С указанием авторства 4.0", а примеры кода – по лицензии Apache 2.0. Подробнее об этом написано в правилах сайта. Java – это зарегистрированный товарный знак корпорации Oracle и ее аффилированных лиц.
Последнее обновление: 2025-08-29 UTC.
[null,null,["Последнее обновление: 2025-08-29 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)"]]