إعداد حزمة تطوير البرامج (SDK) الخاصة بالمستهلك

لبدء مشاركة الرحلات من Fleet Engine والخلفية الخاصة بالعميل، تحتاج إلى تهيئة حزمة تطوير البرامج (SDK) للمستهلكين في تطبيق iOS.

providerID هو نفسه رقم تعريف المشروع الخاص بحسابك على Google Cloud. المشروع. للحصول على معلومات حول إعداد مشروع Google Cloud، يُرجى الاطّلاع على أنشِئ مشروعك على Fleet Engine.

توضِّح الأمثلة التالية كيفية إعداد حزمة تطوير البرامج (SDK) للمستهلكين في تطبيقك.

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

ما هي الخطوات التالية؟

إعداد خريطة