カスタム ナビゲーション エクスペリエンス
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
Navigation SDK には、ナビゲーション エクスペリエンスをアプリに統合するさまざまな方法が用意されています。このページでは、カスタム ナビゲーション エクスペリエンスとは何か、Navigation SDK で利用できる他のナビゲーション エクスペリエンスとどのように異なるかについて説明します。
カスタム ナビゲーション エクスペリエンスとは
Navigation SDK を実装する主な方法は、Google ナビゲーション エクスペリエンスを使用することです。これにより、Google マップアプリ内のナビゲーション エクスペリエンスと同様に、Google が提供する UI 要素とビジュアルを使用するターンバイターン ナビゲーション エクスペリエンスを埋め込むことができます。Google ナビゲーション エクスペリエンスよりも柔軟なナビゲーション エクスペリエンスが必要な場合は、カスタム ナビゲーション エクスペリエンスを実装できます。カスタム ナビゲーション エクスペリエンスとは、ターンバイターン ガイダンスを完全に排除してナビゲーションをバックグラウンド プロセスとしてのみ実行することから、ナビゲーションを実行するデバイスとは別の画面に高度にカスタマイズされたガイダンス エクスペリエンスを投影することまで、あらゆるものを指します。カスタム ナビゲーション エクスペリエンスでは、アプリが Navigation SDK を呼び出してターンバイターン ナビゲーション フィードをリクエストし、ナビゲーション エクスペリエンスでユーザーに表示される UI 要素とビジュアルを提供して管理します。一般的に、Google ナビゲーション エクスペリエンスのほうが実装は簡単ですが、独自のカスタム ナビゲーション エクスペリエンスを構築すると、より多くのカスタマイズが可能になります。
カスタム ナビゲーション エクスペリエンスを作成する場合、アプリは Navigation SDK を呼び出して、次のフローを使用してナビゲーションを開始、実行、停止します。
ナビを開始します。Google ナビゲーション エクスペリエンスと同様に、カスタム ナビゲーション エクスペリエンスでも、ナビゲーション インスタンスを作成して目的地を設定する必要があります。ただし、カスタマイズされたナビゲーション エクスペリエンスでは、まず GMSNavigationService.createNavigationSession
を使用してナビゲーション セッションを確立します。これは、ビュー コントローラを使用するか、使用しないかに関わらず動作できる状態保持型の非 UI オブジェクトです。
詳しくは、ターンバイターン データフィードを有効にするをご覧ください。
デモを見る: Navigation SDK のダウンロードには、デモが含まれています。このデモを実行すると、標準のナビゲーションによるターンバイターン ガイダンスから、道路のポリラインに沿って移動するデバイスの位置のみを表示するナビゲーション エクスペリエンスに切り替わるナビゲーション エクスペリエンスの例を確認できます。
アクティブ ナビゲーション。Google 提供のナビゲーション エクスペリエンスとカスタム ナビゲーション エクスペリエンスのもう 1 つの大きな違いは次のとおりです。Navigation SDK の組み込みイベント マネージャーにガイダンスを渡す代わりに、ターンバイターン フィードを有効にして、イベント ハンドラを実装します。これにより、エクスペリエンスはナビゲーション イベントをリッスンするで説明されているイベントに応答できます。
ナビゲーションを終了します。Google ナビゲーション エクスペリエンスと同様に、カスタム ナビゲーションでも、アプリのエクスペリエンスに最適な方法でナビゲーションを終了する必要があります。
カスタム ナビゲーション エクスペリエンスを使用する場面
次の表に、カスタム ナビゲーションのシナリオを示します。
シナリオの例 |
手順の概要 |
二輪車などの小型デバイス向けに、テキストのみのドライバー ガイダンスを提供する必要があります。 |
ナビゲーターを作成し、ナビゲーターが運転者のモバイル デバイスで実行されている間、ターンバイターン方式のガイダンスを小型画面デバイスへのデータフィードとして設定します。 |
Android Auto を使用するドライバー向けに、アプリをカーサービスとして提供したい。 |
- カーサービスを設定します。
- Navigation SDK プロジェクトを設定します。
- ナビゲーターをまだ確立していない場合は、確立します。
- ターンバイターン方式の経路案内フィードを有効にします。
- 自動アプリのサーフェスに地図を描画し、構成したデータフィードからフィールドに入力します。
詳しくは、Android Auto のナビゲーションを有効にするをご覧ください。 |
アプリを使用するドライバーは、ほとんどの移動で概要地図を必要としており、市街地の道路では最小限のターンバイターン ナビゲーションのみを必要としています。 |
アプリでは、ナビゲーターの目的地と乗車モードの設定を切り替えることなく、必要に応じて Google ナビゲーション エクスペリエンスに出入りできるようにする必要があります。 |
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-09-04 UTC。
[null,null,["最終更新日 2025-09-04 UTC。"],[[["\u003cp\u003eThe Navigation SDK offers both a pre-built Google navigation experience and the flexibility to create custom navigation experiences.\u003c/p\u003e\n"],["\u003cp\u003eCustom navigation experiences allow developers to manage UI elements, visuals, and event handling for a highly tailored user interface.\u003c/p\u003e\n"],["\u003cp\u003eThis customization ranges from background navigation to projecting guidance onto separate screens, giving developers more control.\u003c/p\u003e\n"],["\u003cp\u003eCustom experiences involve starting navigation, managing active navigation with event handlers, and ending navigation as needed.\u003c/p\u003e\n"],["\u003cp\u003eUse cases for custom navigation include text-only guidance, Android Auto integration, and dynamic switching between map views and turn-by-turn instructions.\u003c/p\u003e\n"]]],[],null,["# Custom navigation experience\n\nThe Navigation SDK provides different ways to integrate a navigation\nexperience into your app. This page explains what a custom navigation experience\nis and how it differs from other navigation experiences that are available in\nthe Navigation SDK.\n\nWhat is a custom navigation experience?\n---------------------------------------\n\nThe primary way to implement the Navigation SDK is to use the [Google\nnavigation\nexperience](/maps/documentation/navigation/android-sdk/intro-google-nav),\nwhich lets you embed a turn-by-turn navigation experience that uses\nGoogle-provided UI elements and visuals --- similar to the navigation experience\nwithin the Google Maps apps. If you need more flexibility than the Google\nnavigation experience offers, you can implement a custom navigation experience.\nA custom navigation experience refers to anything from eliminating turn guidance\nentirely with and running navigation only as a background process, to projecting\na highly customized guidance experience to a screen separate from the device\nthat runs the navigation. With a custom navigation experience, your app calls\nthe Navigation SDK to request a turn-by-turn navigation feed, and then\nyou provide and manage the UI elements and visuals that the user sees in the\nnavigation experience. While using the Google navigation experience is generally\neasier to implement, building your own custom navigation experience allows for\nmore customization.\n\nWhen you create a custom navigation experience, your app calls the Navigation\nSDK to start, run, and stop navigation, using the following flow:\n\n1. **Start navigation** . As with the Google navigation experience, a custom\n navigation experience still involves creating a navigation instance and\n setting the destination. However, with a customized navigation experience,\n you achieve this by first establishing a navigation session using\n `GMSNavigationService.createNavigationSession`, which is a state-bearing\n non-UI object that can operate either with a view controller, or without\n one.\n\n For more information, see [Enable turn-by-turn data\n feed](/maps/documentation/navigation/android-sdk/tbt-feed).\n\n **See the demo:** The download of the Navigation SDK contains a demo\n you can run to see an example of a navigation experience that switches\n between turn-by-turn guidance through standard navigation to a navigation\n experience that shows only the device location moving along a road\n polyline.\n2. **Active navigation** . Here is another key difference between a\n Google-provided navigation experience and a custom navigation experience.\n Instead of handing off guidance to the built-in event manager of the\n Navigation SDK, you enable the turn-by-turn feed and implement event\n handlers. This allows your experience to respond to the events described in\n [Listen for navigation\n events](/maps/documentation/navigation/android-sdk/events).\n\n3. **End navigation**. As with the Google navigation experience, custom\n navigation also requires you to terminate navigation in the manner best\n suited for the app's experience.\n\nWhen might you use a custom navigation experience?\n--------------------------------------------------\n\nThe following table describes some custom navigation scenarios.\n\n| **Example scenario** | **High-level steps** |\n|----------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| You need to provide text-only driver guidance for small devices such as 2-wheeled vehicles. | Create your navigator and set up the turn-by-turn guidance as a data feed to a small screen device while the navigator runs on the driver's mobile phone outside of their immediate view. |\n| You want to make your app available as a car service for drivers who use Android Auto. | 1. Set up the car service. 2. Set up your Navigation SDK project. 3. Establish a navigator if you haven't already. 4. Enable the turn-by-turn guidance feed. 5. Draw the map on the auto app surface and populate the fields from the data feed you configured. For more information, see [Enable Navigation for Android Auto](/maps/documentation/navigation/android-sdk/android-auto) |\n| Drivers using your app want an overview map for most of their journey, with only minimal turn-by-turn guidance for city streets. | Your app should allow drivers to enter and exit the Google navigation experience as they need, without alternating the navigator's settings for destination and trip mode. |"]]