รับ Android Consumer SDK
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
หากต้องการแชร์การเดินทางสำหรับการเดินทางแบบออนดีมานด์ในแอปสำหรับผู้บริโภคบน Android ให้ใช้
Consumer SDK ดูข้อมูลเพิ่มเติมเกี่ยวกับการติดตามการเดินทางโดยใช้ Consumer SDK ได้ที่ติดตามการเดินทางใน Android
หากต้องการตั้งค่า Consumer SDK สำหรับแอปสำหรับผู้บริโภคบน Android ให้ทำตามขั้นตอนต่อไปนี้
- ตรวจสอบข้อกำหนดขั้นต่ำของระบบ
- รับ Consumer SDK
- กำหนดค่าโปรเจ็กต์คอนโซล Google Cloud
- รับโทเค็นการตรวจสอบสิทธิ์
- เริ่มต้น Consumer SDK
ตรวจสอบข้อกำหนดขั้นต่ำของระบบ
ดูหมายเหตุประจำรุ่นสำหรับข้อกำหนดขั้นต่ำของ SDK สำหรับผู้บริโภคเวอร์ชันที่คุณใช้ ดูบันทึกประจำรุ่น
หากต้องการใช้ Consumer SDK แอปของคุณต้องกำหนดเป้าหมายเป็น minSdkVersion
23 ขึ้นไป
หากต้องการเรียกใช้แอปที่ใช้ Consumer SDK อุปกรณ์เคลื่อนที่ Android ต้องมีคุณสมบัติตรงตามข้อกำหนดขั้นต่ำต่อไปนี้
รับ Consumer SDK จากที่เก็บ Maven ของ Google
ดาวน์โหลด Consumer SDK เวอร์ชัน 2.1.0 ขึ้นไปจากที่เก็บ Maven ของ Google
เราได้เลิกใช้งานช่องที่เก็บข้อมูลส่วนตัวที่ใช้ก่อนหน้านี้แล้ว
Gradle
เพิ่มโค้ดต่อไปนี้ในไฟล์ build.gradle
repositories {
...
google()
}
Maven
เพิ่มโค้ดต่อไปนี้ในไฟล์ pom.xml
<project>
...
<repositories>
<repository>
<id>google-maven-repository</id>
<url>https://maven.google.com</url>
</repository>
</repositories>
...
</project>
ขั้นตอนถัดไป
กำหนดค่าโปรเจ็กต์ Google Cloud Console
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-31 UTC
[null,null,["อัปเดตล่าสุด 2025-08-31 UTC"],[[["\u003cp\u003eThe Google Maps Platform Consumer SDK enables journey sharing for on-demand trips in Android consumer apps.\u003c/p\u003e\n"],["\u003cp\u003eAndroid apps using the SDK must target minSdkVersion 23 or higher and have Google Play services installed.\u003c/p\u003e\n"],["\u003cp\u003eThe Consumer SDK can be obtained from the Google Maven repository (versions 2.1.0 and later).\u003c/p\u003e\n"],["\u003cp\u003eBefore implementing, ensure the device meets minimum requirements including Android 6.0 (API level 23) or later.\u003c/p\u003e\n"],["\u003cp\u003eNext steps include configuring a Google Cloud Console project and obtaining authentication tokens.\u003c/p\u003e\n"]]],["To share on-demand journeys in Android apps, utilize the Consumer SDK. First, verify the minimum system requirements, which include Android 6.0 (API level 23) or later, and Google Play services. Next, retrieve the Consumer SDK (version 2.1.0 or later) from the Google Maven repository by modifying the `build.gradle` or `pom.xml` file to include the Google repository. Finally, configure a Google Cloud console project. Authentication and SDK initialization are also required.\n"],null,["Select platform: [Android](/maps/documentation/mobility/journey-sharing/on-demand/android/setup \"View this page for the Android platform docs.\") [iOS](/maps/documentation/mobility/journey-sharing/on-demand/ios/setup \"View this page for the iOS platform docs.\") [JavaScript](/maps/documentation/mobility/journey-sharing/on-demand/javascript/setup \"View this page for the JavaScript platform docs.\")\n\n\u003cbr /\u003e\n\nTo share journeys for on-demand trips in your Android consumer apps, use the\nConsumer SDK. For more information on following a trip using the Consumer SDK,\nsee [Follow a trip in Android](/maps/documentation/mobility/journey-sharing/on-demand).\n| For examples, see [Android sample apps](https://github.com/googlemaps/android-on-demand-rides-deliveries-samples) or [combined samples](https://github.com/googlemaps/on-demand-rides-deliveries-samples) on GitHub.\n\nTo set up the Consumer SDK for your Android consumer app, follow these steps:\n\n1. [Check the minimum system requirements](#check-min)\n2. [Get the Consumer SDK](#maven)\n3. [Configure a Google Cloud console project](/maps/documentation/mobility/journey-sharing/on-demand/android/configure-project)\n4. [Get authentication tokens](/maps/documentation/mobility/journey-sharing/on-demand/android/auth-sdk)\n5. [Initialize the Consumer SDK](/maps/documentation/mobility/journey-sharing/on-demand/android/init-sdk)\n\nCheck the minimum system requirements\n\nSee the release notes for the minimum requirements for the version of the\nConsumer SDK you are using. See [Release notes](/maps/documentation/mobility/services/resources/relnotes_consumer_sdk_android).\n\n**To use the Consumer SDK** : Your app must target `minSdkVersion`\n23 or higher.\n\n**To run an app that uses the Consumer SDK**: Android mobile devices must meet\nthe following minimum requirements:\n\n- Running Android 6.0 (API level\n 23) or later.\n\n- Have [Google Play services](https://developers.google.com/android/guides/overview) installed.\n\nGet the Consumer SDK from the Google Maven repository\n\nGet the Consumer SDK versions 2.1.0 and later from the Google Maven repository.\nThe previously used private repository channel has been deprecated. \n\nGradle\n\nAdd the following to your `build.gradle` file: \n\n repositories {\n ...\n google()\n }\n\nMaven\n\nAdd the following to your `pom.xml` file: \n\n \u003cproject\u003e\n ...\n \u003crepositories\u003e\n \u003crepository\u003e\n \u003cid\u003egoogle-maven-repository\u003c/id\u003e\n \u003curl\u003ehttps://maven.google.com\u003c/url\u003e\n \u003c/repository\u003e\n \u003c/repositories\u003e\n ...\n \u003c/project\u003e\n\nWhat's next\n\n[Configure a Google Cloud Console project](/maps/documentation/mobility/journey-sharing/on-demand/android/configure-project)"]]