ภาพรวม
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
Navigation SDK สำหรับ Android จะเพิ่มฟีเจอร์การนำทางลงใน Maps SDK สำหรับ Android หากแอปพลิเคชัน Android ที่ขับเคลื่อนโดย Google Maps
ต้องการฟีเจอร์การนำทาง แอปจะต้องใช้ Navigation SDK สำหรับ Android
อย่างไรก็ตาม ฟังก์ชันส่วนใหญ่ใน Maps SDK สำหรับ Android จะทำงานเหมือนกันใน Navigation SDK สำหรับ Android คุณเข้าถึงได้โดยใช้com.google.android.gms.maps
แพ็กเกจเดียวกัน ไม่ว่าคุณจะใช้ทรัพยากร Dependency ของ SDK ใดก็ตาม
ซึ่งหมายความว่าหากก่อนหน้านี้แอปของคุณขึ้นอยู่กับ Maps SDK สำหรับ Android คุณสามารถเปลี่ยนการอ้างอิงเป็น Navigation SDK สำหรับ Android ได้โดยไม่ส่งผลต่อฟังก์ชันการทำงานที่มีอยู่ของแอป โดยมีข้อยกเว้นที่สำคัญ 2 ประการดังนี้
- API ที่ส่งข้อยกเว้น
- API ที่ไม่ทำงานใน NavSDK และไม่มีผลกระทบเมื่อเรียกใช้
โดยข้อยกเว้นเหล่านี้มีคำอธิบายอยู่ด้านล่าง
API ที่ส่งข้อยกเว้น
ฟังก์ชันต่อไปนี้จะส่งข้อยกเว้นหากแอปพลิเคชันของคุณเปิดใช้
API ที่ไม่มีฟังก์ชันการทำงานใน Navigation SDK
API ต่อไปนี้ไม่มีฟังก์ชันการทำงานใน Navigation SDK แต่ก็ไม่มี
ผลกระทบหากโค้ดของคุณเรียกใช้ โดยจะอยู่ในหมวดหมู่ต่อไปนี้
- API สำหรับกิจกรรมที่สวมใส่ได้
- เปิดใช้ฟีด TBT แทนหากต้องการฟังก์ชันนี้ใน
Navigation SDK สำหรับ Android
- API อื่นๆ
API สำหรับอุปกรณ์ที่สวมใส่ได้
GoogleMapOptions.ambientEnabled(boolean enabled) จะ
โดยปกติแล้วจะช่วยให้คุณปิดหรือเปิดใช้โหมดแอมเบียนท์สำหรับ
แอปที่ใช้กับอุปกรณ์สวมใส่ได้ นอกจากนี้
เมธอด onEnterAmbient
และ
onExitAmbient
จะอยู่ใน MapView และ MapFragment แต่จะไม่มีผลเมื่อเรียกใช้ สำหรับอุปกรณ์ที่สวมใส่ได้ ให้ใช้ฟีด TBT แทน
API อื่นๆ
API ที่มีไว้สำหรับลูกค้าบริการการเดินทางเท่านั้น
Navigation SDK มี API หลายรายการที่ออกแบบมาเพื่อใช้โดยลูกค้าของบริการการเดินทางเท่านั้น ซึ่ง Google จะเรียกเก็บเงินตามธุรกรรม หากคุณไม่ใช่ลูกค้า Mobility Services วิธีต่อไปนี้จะใช้ไม่ได้
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-31 UTC
[null,null,["อัปเดตล่าสุด 2025-08-31 UTC"],[[["\u003cp\u003eThe Navigation SDK for Android provides navigation features on top of the Maps SDK for Android and is a required dependency for apps needing navigation.\u003c/p\u003e\n"],["\u003cp\u003eMost Maps SDK functionalities remain the same in the Navigation SDK, accessible via the \u003ccode\u003ecom.google.android.gms.maps\u003c/code\u003e package.\u003c/p\u003e\n"],["\u003cp\u003eCertain APIs behave differently in the Navigation SDK, either throwing exceptions (like LiteMode) or having no functionality (like wearable APIs and custom LocationSource).\u003c/p\u003e\n"],["\u003cp\u003eFor wearable apps, the TBT feed should be used instead of ambient mode functionalities.\u003c/p\u003e\n"],["\u003cp\u003eSome APIs are exclusively for Mobility Services customers and function as no-ops for other users.\u003c/p\u003e\n"]]],[],null,["# Overview\n\nThe Navigation SDK for Android adds navigation features to the\nMaps SDK for Android. If your Google Maps-powered Android application\nneeds navigation features, it must depend on the Navigation SDK for Android.\n\nThat said, most functions in the Maps SDK for Android behave the same in\nthe Navigation SDK for Android. You access them using the same\n`com.google.android.gms.maps` package, no matter which SDK dependency you use.\nThis means that, if your app previously depended on the\nMaps SDK for Android, you can change its dependency to the\nNavigation SDK for Android without affecting the existing functionality of your app, with\ntwo notable exceptions:\n\n- APIs that throw an exception.\n- APIs that don't function in the NavSDK and have no impact when called.\n\nThese exceptions are described below.\n\nAPIs that throw an exception\n----------------------------\n\nThe following function throws an exception if your application enables it:\n\n- [LiteMode](/maps/documentation/navigation/android-sdk/reference/com/google/android/gms/maps/GoogleMapOptions#liteMode(boolean))\n\nAPIs with no functionality in Navigation SDK\n--------------------------------------------\n\nThe following APIs have no functionality in the Navigation SDK, but also have no\nimpact if your code calls them. They fall into the following categories:\n\n- APIs for wearable activity.\n - Enable [TBT feed](/maps/documentation/navigation/android-sdk/tbt-feed) instead if you want this functionality in the Navigation SDK for Android.\n- Other APIs.\n\n### APIs for wearables\n\n[GoogleMapOptions.ambientEnabled(boolean enabled)](/maps/documentation/navigation/android-sdk/reference/com/google/android/gms/maps/GoogleMapOptions#ambientEnabled(boolean)) would\nnormally allow you to disable or enable [ambient mode](/maps/documentation/android-sdk/wear#ambient) for\nwearable apps. Additionally,\n[onEnterAmbient](/maps/documentation/navigation/android-sdk/reference/com/google/android/gms/maps/MapView#onEnterAmbient(android.os.Bundle))\nand\n[onExitAmbient](/maps/documentation/navigation/android-sdk/reference/com/google/android/gms/maps/MapView#onExitAmbient())\nmethods exist in [MapView](/maps/documentation/navigation/android-sdk/reference/com/google/android/gms/maps/MapView) and [MapFragment](/maps/documentation/navigation/android-sdk/reference/com/google/android/gms/maps/MapFragment), but have\nno impact when called. For wearables, use the [TBT feed](/maps/documentation/navigation/android-sdk/tbt-feed) instead.\n\n### Other APIs\n\n- [Setting a custom LocationSource](/maps/documentation/navigation/android-sdk/reference/com/google/android/gms/maps/GoogleMap#setLocationSource(com.google.android.gms.maps.LocationSource)) does nothing in the NavSDK.\n- All [MapsInitializer](/maps/documentation/navigation/android-sdk/reference/com/google/android/gms/maps/MapsInitializer) APIs.\n- [RuntimeRemoteException](/maps/documentation/navigation/android-sdk/reference/com/google/android/gms/maps/model/RuntimeRemoteException).\n\nAPIs that are only intended for use by Mobility Services customers\n------------------------------------------------------------------\n\n\nThere are several APIs in the Navigation SDK that are only intended for use by [Mobility Services](/maps/documentation/transportation-logistics/mobility) customers, who are billed by Google on a per-transaction basis. If you are not a Mobility Services customer, the following methods are no-ops:\n\n- [`NavigationTransactionRecorder.pickup()`](/maps/documentation/navigation/android-sdk/reference/com/google/android/libraries/navigation/NavigationTransactionRecorder#pickup(com.google.android.libraries.navigation.Waypoint,%20java.util.List%3Cjava.lang.String%3E))\n- [`NavigationTransactionRecorder.dropoff()`](/maps/documentation/navigation/android-sdk/reference/com/google/android/libraries/navigation/NavigationTransactionRecorder#dropoff(com.google.android.libraries.navigation.Waypoint,%20java.util.List%3Cjava.lang.String%3E))\n- [`NavigationTransactionRecorder.generatedTransactionId()`](/maps/documentation/navigation/android-sdk/reference/com/google/android/libraries/navigation/NavigationTransactionRecorder#public-static-string-generatetransactionid)\n- [`Navigator.fetchRouteInfo()`](/maps/documentation/navigation/android-sdk/reference/com/google/android/libraries/navigation/Navigator#public-abstract-listenableresultfuturerouteinfo-fetchrouteinfo-waypoint-waypoint,-routingoptions-routingoptions)\n- [`Navigator.setTransactionIds()`](/maps/documentation/navigation/android-sdk/reference/com/google/android/libraries/navigation/Navigator#public-abstract-void-settransactionids-liststring-transactionids)"]]