Mengonfigurasi project Konsol Google Cloud
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Untuk mengonfigurasi project aplikasi seluler dan project konsol Google Cloud untuk Driver SDK, ikuti langkah-langkah berikut:
- Jika Anda belum memiliki project pengembangan konsol Google Cloud dan kunci API
untuk project mobilitas, Anda harus menyiapkannya. Untuk mengetahui informasi selengkapnya, lihat
Membuat project Fleet Engine.
- Di Konsol Google Cloud, pilih project Konsol Google Cloud dan kunci API yang sama dengan yang Anda gunakan untuk Fleet Engine.
- Pilih APIs & Services, filter menurut Maps, lalu cari dan aktifkan Maps SDK for iOS.
Tambahkan kunci API Anda ke project
Contoh berikut menunjukkan cara menambahkan kunci API ke project Anda di Xcode:
Swift
Tambahkan kunci API ke AppDelegate.swift
sebagai berikut:
Tambahkan pernyataan impor berikut:
import GoogleMaps
import GoogleRidesharingDriver
Tambahkan kode berikut ke metode application(_:didFinishLaunchingWithOptions:)
Anda:
GMSServices.provideAPIKey("YOUR_API_KEY")
Objective-C
Tambahkan kunci API ke AppDelegate.m
sebagai berikut:
Tambahkan pernyataan impor berikut:
@import GoogleMaps;
@import GoogleGoogleRidesharingDriver;
Tambahkan kode berikut ke metode application:didFinishLaunchingWithOptions:
Anda:
[GMSServices provideAPIKey:@"YOUR_API_KEY"];
Langkah berikutnya
Membuat token autentikasi
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0, sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0. Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers. Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-08-31 UTC.
[null,null,["Terakhir diperbarui pada 2025-08-31 UTC."],[[["\u003cp\u003eSet up a Google Cloud console development project and API key for your mobility project if you don't have one already.\u003c/p\u003e\n"],["\u003cp\u003eEnable the Maps SDK for iOS within your Google Cloud console project.\u003c/p\u003e\n"],["\u003cp\u003eAdd your API key to your iOS project (\u003ccode\u003eAppDelegate\u003c/code\u003e file) using the provided code snippets for either Swift or Objective-C.\u003c/p\u003e\n"],["\u003cp\u003eAfter configuration, proceed to create authentication tokens for Driver SDK functionalities.\u003c/p\u003e\n"]]],[],null,["# Configure a Google Cloud console project\n\nTo configure your mobile app project and Google Cloud console project for the Driver\nSDK, follow these steps:\n\n1. If you don't have a Google Cloud console development project and an API key for your mobility project, you need to set one up. For more information, see [Create your Fleet Engine project](/maps/documentation/mobility/fleet-engine/essentials/set-up-fleet/create-project).\n2. In the Google Cloud console, select the same Google Cloud console project and API key that you are using for Fleet Engine.\n3. Select **APIs \\& Services** , filter by **Maps**, and then search for and enable the Maps SDK for iOS.\n\nAdd your API key to the project\n-------------------------------\n\nThe following examples show how to add the API key to your project in Xcode: \n\n### Swift\n\nAdd your API key to your `AppDelegate.swift` as follows:\n\n1. Add the following import statements:\n\n import GoogleMaps\n import GoogleRidesharingDriver\n\n2. Add the following to your `application(_:didFinishLaunchingWithOptions:)`\n method:\n\n GMSServices.provideAPIKey(\"\u003cvar translate=\"no\"\u003eYOUR_API_KEY\u003c/var\u003e\")\n\n### Objective-C\n\nAdd your API key to your `AppDelegate.m` as follows:\n\n1. Add the following import statements:\n\n @import GoogleMaps;\n @import GoogleGoogleRidesharingDriver;\n\n2. Add the following to your `application:didFinishLaunchingWithOptions:`\n method:\n\n [GMSServices provideAPIKey:@\"\u003cvar translate=\"no\"\u003eYOUR_API_KEY\u003c/var\u003e\"];\n\nWhat's next\n-----------\n\n[Create authentication tokens](/maps/documentation/mobility/driver-sdk/scheduled/ios/authenticate)"]]