オンデマンドルートとは何ですか?
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
このセクションのドキュメントでは、Google Maps Mobility のオンデマンド乗車サービスを使用して乗車を作成し、操作する方法について説明します。次の内容を理解していることを前提としています。
使用する TripService
は、gRPC と REST で使用できます。わかりやすくするために、フィールド参照は gRPC 規約に従います。
オンデマンド サービスの Fleet Engine では、乗車は、ユーザーからのフード デリバリーや乗車リクエストの履行をモデル化する一種の移動です。乗車には、NEW
、ENROUTE_TO_PICKUP
など、移動の進行に合わせて Fleet Engine に報告するステータスがあります。乗車ステータスは、車両に割り当てられた位置情報付きの経由地に対応しています。Fleet Engine は、ユーザーが乗車を更新するたびに、これらの車両の経由地を変更します。車両と乗車との関係について詳しくは、Fleet Engine の基本のオンデマンド乗車をご覧ください。
旅行のライフサイクル
Fleet Engine で各乗車を追跡するには、まず Trip
エンティティを作成する必要があります。参考までに、gRPC または REST をご覧ください。
次の表に、システムで作成された乗車と Fleet Engine でのライフサイクル ステージの例を示します。このガイドでは、Fleet Engine を設定済みで、ドライバー アプリで位置情報の更新が有効になっている移動に割り当てる車両があることを前提としています。Driver SDK: オンデマンドの移動をご覧ください。
1 |
予約リクエストを受け取ります。 |
Fleet Engine の乗車が開始される前に、まず予約システムがアプリまたは他の予約システムを通じて、利用者から乗車または配達のリクエストを受け取ります。システムは、乗車場所などの必須フィールドを含む CreateTrip を使用して、乗車エンティティを作成します。この時点で、乗客や降車場所などの他のフィールドを設定することも、車両が割り当てられるまで待つこともできます。1 つの目的地への旅行を作成するをご覧ください。 |
2 |
車両を割り当てます。 |
システム内で車両を乗車に直接割り当てて Fleet Engine に割り当てを報告するか、車両の検索サービスを使用して車両を検索し、乗車と車両の両方の属性でフィルタして、乗車を完了する最適な車両を見つけることができます。検索範囲内のオンライン車両は、Driver SDK から提供される位置情報の更新を通じて、その近接性を知らせます。
SearchVehicle が乗車と一致する車両を返すと、システムは UpdateTrip エンドポイントを呼び出して、NEW 乗車に割り当てた車両 ID を報告します。
|
3 |
ルートを更新します。 |
ドライバーが乗車を承諾し、お迎え場所へのナビゲーションを開始すると、システムは乗車のステータスを NEW から ENROUTE_TO_PICKUP に更新します。アプリからバックエンドへの直接接続、または Driver SDK から車両の位置情報の継続的なストリームを受信する Fleet Engine のポーリングのいずれかを通じて、乗車中も車両の位置情報のポーリングを継続します。システムは各乗車マイルストーンを Fleet Engine に報告し、Fleet Engine はそれに応じて車両のウェイポイント リストを更新します。 |
4 |
カスタマー ジャーニーをユーザーと共有します。 |
Fleet Engine は、乗車に関する詳細情報と車両の位置情報を Consumer SDK で利用できるようにします。Consumer SDK はリスナーを使用して乗車に関する最新情報を受け取り、ユーザー向けアプリに表示します。Fleet Engine は、到着予定時刻、残り距離、ルート、車両の残りの経由地を自動的に更新します。詳しくは、オンデマンド乗車で乗車経路を共有するをご覧ください。 |
5 |
旅行を完了します。 |
車両が乗車地の経由地に到着し、ドライバーが乗車が完了したことを示すと、Fleet Engine で TripStatus が COMPLETE に設定されます。車両と同様に、乗車エンティティはステータスに関係なく Fleet Engine 内で 7 日間アクティブな状態が続き、その後削除されます。 |
乗車シーケンス フロー
次の図は、このフローの詳細を示しています。

次のステップ
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-08-31 UTC。
[null,null,["最終更新日 2025-08-31 UTC。"],[[["\u003cp\u003eThis documentation provides a comprehensive guide on utilizing the Google Maps Mobility on-demand trips service for managing and tracking trips.\u003c/p\u003e\n"],["\u003cp\u003eYou should have a foundational understanding of Fleet Engine, Vehicle Basics, and Trip Basics for on-demand services.\u003c/p\u003e\n"],["\u003cp\u003eFleet Engine's \u003ccode\u003eTripService\u003c/code\u003e enables the creation, assignment, updating, and completion of trips through gRPC or REST.\u003c/p\u003e\n"],["\u003cp\u003eTrips represent journeys fulfilling consumer requests, evolving through various statuses like \u003ccode\u003eNEW\u003c/code\u003e, \u003ccode\u003eENROUTE_TO_PICKUP\u003c/code\u003e, and \u003ccode\u003eCOMPLETE\u003c/code\u003e, influencing vehicle waypoints.\u003c/p\u003e\n"],["\u003cp\u003eThe trip lifecycle includes booking, vehicle assignment, status updates, consumer journey sharing, and completion, all managed through Fleet Engine interactions.\u003c/p\u003e\n"]]],[],null,["The documentation in this section shows how to create and work with trips using\nthe Google Maps Mobility on-demand trips service. It assumes familiarity with\nthe following:\n\n- **Fleet Engine** : You should be familiar with Fleet Engine implementation details, request mechanisms, and security. For that, see [What is the Fleet\n Engine service?](/maps/documentation/mobility/fleet-engine/essentials) and the security topics in [Set up Fleet Engine](/maps/documentation/mobility/fleet-engine/essentials/set-up-fleet).\n- **Vehicles basics** for on-demand services. See [Introduction to vehicles](/maps/documentation/mobility/fleet-engine/essentials/vehicles-intro).\n- **Trip basics** for on-demand services. See [On-demand trips](/maps/documentation/mobility/fleet-engine/essentials/trip-intro).\n\nThe `TripService` that you'll use is available for [gRPC](/maps/documentation/mobility/fleet-engine/reference/trips/rpc/maps.fleetengine.v1#tripservice) and [REST](/maps/documentation/mobility/fleet-engine/reference/trips/rest/v1/providers.trips).\nFor simplicity sake, field references follow the gRPC convention.\n\nIn Fleet Engine for on-demand services, a trip is a type of journey that models\nthe fulfillment of a food delivery or ride request from your consumers. A trip\nhas a status that you report to Fleet Engine as the journey evolves, such as\n`NEW`, `ENROUTE_TO_PICKUP`, and more. The trip status corresponds to geo-located\nwaypoints assigned to the vehicle, and Fleet Engine modifies these vehicle\nwaypoints with each trip update you make. See [On demand trips](/maps/documentation/mobility/fleet-engine/essentials/trip-intro) in **Fleet\nEngine essentials** for more about trips and their relationship to vehicles.\n\nLife of a trip\n\nIn order to track each trip in Fleet Engine, you must first create a `Trip`\nentity. See either [gRPC](/maps/documentation/mobility/fleet-engine/reference/trips/rpc/maps.fleetengine.v1#maps.fleetengine.v1.Trip) or [REST](/maps/documentation/mobility/fleet-engine/reference/trips/rest/v1/providers.trips) for reference.\n\nThe following table describes an example end-to-end flow of a trip created in\nyour system and its lifecycle stages in Fleet Engine. It assumes you have set up\nFleet Engine and have a vehicle to assign to the trip, with location updates\nenabled in the driver app. See [Driver SDK: On-demand trips](/maps/documentation/mobility/driver-sdk/on-demand).\n\n|---|----------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| 1 | **Receive booking request.** | Before a Fleet Engine trip begins, your booking system first receives a request for a ride or delivery from a consumer through your app or other booking system. Your system then creates the trip entity using `CreateTrip` with required fields, such as the pickup location. It can also set other fields at this point, such passengers and dropoff location, or wait until it assigns a vehicle. See [Create a single-destination trip](/maps/documentation/mobility/fleet-engine/journeys/trips/create-trip). |\n| 2 | **Assign vehicle.** | You can either assign vehicles to trips directly within your system and report the assignment to Fleet Engine, or you can use the [Search Vehicle](/maps/documentation/mobility/fleet-engine/essentials/vehicles/on-demand-search-vehicle) service to search for vehicles, filtering by both trip and vehicle attributes to find the best vehicle to complete the journey. Any online vehicle within your search radius makes their proximity known through location updates provided by the Driver SDK. Once `SearchVehicle` returns a vehicle that you match to a trip, your system calls the `UpdateTrip` endpoint to report the vehicle ID you assigned to the `NEW` trip. |\n| 3 | **Update trip.** | Once the driver accepts the trip and begins navigating to the pickup location, your system updates the trip status from `NEW` to `ENROUTE_TO_PICKUP`. You continue to poll the vehicle location throughout the journey, either through a direct connection from the app to your backend, or by polling Fleet Engine, which receives an ongoing stream of vehicle location updates from the Driver SDK. Your system then reports each journey milestone to Fleet Engine, which updates the vehicle's waypoint list accordingly. |\n| 4 | **Share journey with consumer.** | Fleet Engine makes trip details and vehicle location available to the Consumer SDK, which uses a listener to receive trip updates and display them in the consumer app. Fleet Engine automatically updates ETA, remaining distance, routes, and remaining vehicle waypoints. See [Share journeys for on-demand trips](/maps/documentation/mobility/journey-sharing/on-demand) for more information. |\n| 5 | **Complete trip.** | Once the vehicle reaches the destination waypoint of the trip and your driver indicates a successful trip, your system sets the `TripStatus` to `COMPLETE` in Fleet Engine. Keep in mind that, like vehicles, trip entities remain active within Fleet Engine for 7 days regardless of status, at which point they are removed. |\n\nTrip sequence flow\n\nThe following diagram shows a more detailed view of this flow.\n\nWhat's next\n\n- [Create a single-destination trip](/maps/documentation/mobility/fleet-engine/journeys/trips/create-trip)"]]