Tüketici SDK'sını başlatma
Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Fleet Engine ve müşteri arka ucundan yolculuk paylaşımına başlamak için iOS uygulamanızda Consumer SDK'yı başlatmanız gerekir.
providerID
, Google Cloud projenizin proje kimliği ile aynıdır. Google Cloud projesini ayarlama hakkında bilgi için Fleet Engine projenizi oluşturma başlıklı makaleyi inceleyin.
Aşağıdaki örneklerde, Consumer SDK'nın uygulamanızda nasıl başlatılacağı gösterilmektedir.
Swift
/*
* AppDelegate.swift
*/
import GoogleRidesharingConsumer
import GoogleMaps
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Register your API key for GMSServices.
GMSServices.provideAPIKey(yourMapsAPIKey)
// Set the instance of the SampleAccessTokenProvider.
GMTCServices.setAccessTokenProvider(SampleAccessTokenProvider(), providerID: yourProviderID)
// Other initialization code ...
return true
}
}
Objective-C
/*
* AppDelegate.m
*/
#import <GoogleMaps/GoogleMaps.h>
#import <GoogleRidesharingConsumer/GoogleRidesharingConsumer.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
//Register your API key for GMSServices.
[GMSServices provideAPIKey:yourMapsAPIKey];
//Set the instance of the AccessTokenFactory.
[GMTCServices setAccessTokenProvider:[[SampleAccessTokenProvider alloc] init]
providerID:yourProviderID];
// Other initialization code ...
return YES;
}
@end
Sonraki Adımlar
Harita oluşturma
Aksi belirtilmediği sürece bu sayfanın içeriği Creative Commons Atıf 4.0 Lisansı altında ve kod örnekleri Apache 2.0 Lisansı altında lisanslanmıştır. Ayrıntılı bilgi için Google Developers Site Politikaları'na göz atın. Java, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2025-08-17 UTC.
[[["Anlaması kolay","easyToUnderstand","thumb-up"],["Sorunumu çözdü","solvedMyProblem","thumb-up"],["Diğer","otherUp","thumb-up"]],[["İhtiyacım olan bilgiler yok","missingTheInformationINeed","thumb-down"],["Çok karmaşık / çok fazla adım var","tooComplicatedTooManySteps","thumb-down"],["Güncel değil","outOfDate","thumb-down"],["Çeviri sorunu","translationIssue","thumb-down"],["Örnek veya kod sorunu","samplesCodeIssue","thumb-down"],["Diğer","otherDown","thumb-down"]],["Son güncelleme tarihi: 2025-08-17 UTC."],[[["\u003cp\u003eTo share journeys from Fleet Engine and your backend, you must initialize the Consumer SDK in your iOS application using your Google Cloud Project ID (\u003ccode\u003eproviderID\u003c/code\u003e) and API key.\u003c/p\u003e\n"],["\u003cp\u003eThe provided Swift and Objective-C code snippets demonstrate how to initialize the SDK within your app's AppDelegate.\u003c/p\u003e\n"],["\u003cp\u003eAfter initializing the SDK, you can proceed with setting up a map to display journey information using the provided documentation link.\u003c/p\u003e\n"]]],[],null,["To start sharing journeys from Fleet Engine and the customer backend,\nyou need to initialize the Consumer SDK in your iOS application.\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 examples show how to initialize the Consumer SDK in your app. \n\nSwift \n\n /*\n * AppDelegate.swift\n */\n import GoogleRidesharingConsumer\n import GoogleMaps\n\n @UIApplicationMain\n class AppDelegate: UIResponder, UIApplicationDelegate {\n\n func application(_ application: UIApplication,\n didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -\u003e Bool {\n\n // Register your API key for GMSServices.\n\n GMSServices.provideAPIKey(yourMapsAPIKey)\n\n // Set the instance of the SampleAccessTokenProvider.\n\n GMTCServices.setAccessTokenProvider(SampleAccessTokenProvider(), providerID: yourProviderID)\n\n // Other initialization code ...\n\n return true\n }\n }\n\nObjective-C \n\n /*\n * AppDelegate.m\n */\n #import \u003cGoogleMaps/GoogleMaps.h\u003e\n #import \u003cGoogleRidesharingConsumer/GoogleRidesharingConsumer.h\u003e\n\n @implementation AppDelegate\n\n - (BOOL)application:(UIApplication *)application\n didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {\n //Register your API key for GMSServices.\n [GMSServices provideAPIKey:yourMapsAPIKey];\n\n //Set the instance of the AccessTokenFactory.\n [GMTCServices setAccessTokenProvider:[[SampleAccessTokenProvider alloc] init]\n providerID:yourProviderID];\n\n // Other initialization code ...\n return YES;\n }\n\n @end\n\nWhat's Next\n\n[Set up a map](/maps/documentation/mobility/journey-sharing/on-demand/ios/create-ui)"]]