กำหนดค่าโปรเจ็กต์คอนโซล Google Cloud
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
หากต้องการกำหนดค่าโปรเจ็กต์แอปบนอุปกรณ์เคลื่อนที่และโปรเจ็กต์คอนโซล Google Cloud สำหรับ Driver
SDK ให้ทำตามขั้นตอนต่อไปนี้
- หากไม่มีโปรเจ็กต์การพัฒนาคอนโซล Google Cloud และคีย์ API
สำหรับโปรเจ็กต์การเดินทาง คุณจะต้องตั้งค่า ดูข้อมูลเพิ่มเติมได้ที่
สร้างโปรเจ็กต์ Fleet Engine
- ใน Google Cloud Console ให้เลือกโปรเจ็กต์ Google Cloud Console และ
คีย์ API เดียวกันกับที่ใช้สำหรับ Fleet Engine
- เลือก API และบริการ กรองตาม Maps แล้วค้นหาและ
เปิดใช้ Maps SDK สำหรับ iOS
เพิ่มคีย์ API ลงในโปรเจ็กต์
ตัวอย่างต่อไปนี้แสดงวิธีเพิ่มคีย์ API ลงในโปรเจ็กต์ใน Xcode
Swift
เพิ่มคีย์ API ลงใน AppDelegate.swift
ดังนี้
เพิ่มคำสั่งนำเข้าต่อไปนี้
import GoogleMaps
import GoogleRidesharingDriver
เพิ่มโค้ดต่อไปนี้ลงในเมธอด application(_:didFinishLaunchingWithOptions:)
GMSServices.provideAPIKey("YOUR_API_KEY")
Objective-C
เพิ่มคีย์ API ลงใน AppDelegate.m
ดังนี้
เพิ่มคำสั่งนำเข้าต่อไปนี้
@import GoogleMaps;
@import GoogleGoogleRidesharingDriver;
เพิ่มโค้ดต่อไปนี้ลงในเมธอด application:didFinishLaunchingWithOptions:
[GMSServices provideAPIKey:@"YOUR_API_KEY"];
ขั้นตอนถัดไป
สร้างโทเค็นการตรวจสอบสิทธิ์
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-31 UTC
[null,null,["อัปเดตล่าสุด 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)"]]