[null,null,["最后更新时间 (UTC):2025-08-31。"],[[["\u003cp\u003eThis guide provides an alternative to the Consumer SDK for retrieving real-time trip data like location, ETA, and routing directly from Fleet Engine, giving you more control over the user experience.\u003c/p\u003e\n"],["\u003cp\u003eYou can retrieve trip information using the \u003ccode\u003eGetTrip\u003c/code\u003e method with the \u003ccode\u003eJOURNEY_SHARING_V1S\u003c/code\u003e view, and poll it for updates, ideally every 10 seconds.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eTrip\u003c/code\u003e object returned contains various fields including \u003ccode\u003etrip_status\u003c/code\u003e, \u003ccode\u003elast_location\u003c/code\u003e, \u003ccode\u003eremaining_waypoints\u003c/code\u003e, and more.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eremaining_waypoints\u003c/code\u003e field provides a list of waypoints the vehicle needs to travel, with the \u003ccode\u003eJOURNEY_SHARING_V1S\u003c/code\u003e view ensuring the first waypoint reflects the vehicle's latest position.\u003c/p\u003e\n"],["\u003cp\u003eFor back-to-back or shared trips, \u003ccode\u003eremaining_waypoints\u003c/code\u003e may include waypoints from other trips, requiring careful consideration of privacy implications when displaying this information.\u003c/p\u003e\n"]]],["To retrieve trip data directly from Fleet Engine, use the `GetTrip` method with the `JOURNEY_SHARING_V1S` view. Poll the service every 10 seconds to monitor vehicle progress, checking `Trip.last_location.update_time` for updates. The `Trip` object provides fields like `trip_status`, `remaining_waypoints`, and `last_location`. `remaining_waypoints` shows the vehicle's route, including pickups/drop-offs, potentially from other trips. Be cautious of privacy implications when displaying other trips waypoints.\n"],null,["This guide shows you how to retrieve trip data directly from Fleet Engine, as an\nalternative to using the Consumer SDK. You can use this approach for more\ncontrol over your end-user experience while still taking advantage of Fleet\nEngine's accurate and real-time vehicle location, ETA, and routing.\n\nFor details on using the Consumer SDK, see [Share journeys for on-demand\ntrips](/maps/documentation/mobility/journey-sharing/on-demand).\n\nRetrieve trip information\n\nTo retrieve trip information from Fleet Engine directly, call the `GetTrip`\nmethod, specifying the `JOURNEY_SHARING_V1S` view. See reference for [RPC](/maps/documentation/mobility/fleet-engine/reference/trips/rpc/maps.fleetengine.v1#tripview) or\n[REST](/maps/documentation/mobility/fleet-engine/reference/trips/rest/v1/providers.trips#tripview).\n\nYour server would typically poll the trip service for the status of each trip\nwhile the rider is actively monitoring vehicle progress. Vehicle location\nupdates typically occur every 10 seconds and your system should poll at that\nsame rate. The `Trip.last_location.update_time` field can be monitored to see if\nthere have been any updates since the previous call to `GetTrip`. \n\n static final String PROJECT_ID = \"my-rideshare-co-gcp-project\";\n static final String TRIP_ID = \"trip-A\";\n\n String tripName = \"providers/\" + PROJECT_ID + \"/trips/\" + TRIP_ID;\n GetTripRequest getTripRequest =\n GetTripRequest.newBuilder()\n .setName(tripName)\n .setView(JOURNEY_SHARING_V1S)\n .build();\n Trip trip = tripService.getTrip(getTripRequest);\n\nThe resulting `Trip` object has the following fields populated with the latest\navailable information for the trip:\n\n|------------------------|-------------------------------------|----------------------------------|\n| `name` | `trip_status` | `remaining_waypoints` |\n| `vehicle_id` | `trip_type` | `last_location` |\n| `number_of_passengers` | `pickup_point` | `view (== JOURNEY_SHARING_V1S)` |\n| `actual_pickup_point` | `intermediate_destinations` | `intermediate_destination_index` |\n| `pickup_time` | `intermediate_destinations_version` | `dropoff_point` |\n| `actual_dropoff_point` | `dropoff_time` | |\n\nRetrieve remaining trip waypoints\n\nThe Trip entity contains a repeated field of type `TripWaypoint` This field\nincludes all waypoints that the vehicle will need to travel, in order, before\nthis trip's final drop-off point. Specifying the Journey Sharing view tells\nFleet Engine to put updated information in the remaining_waypoints\\[0\\]\n`TripWaypoint`. In other, non-Journey Sharing views, that waypoint does not\nusually reflect the latest position of the assigned vehicle. See the\nreference for [RPC](/maps/documentation/mobility/fleet-engine/reference/trips/rpc/maps.fleetengine.v1#tripwaypoint) or [REST](/maps/documentation/mobility/fleet-engine/reference/trips/rest/v1/TripWaypoint).\n\nFor more information, see [Trip status and remaining vehicle waypoints](/maps/documentation/mobility/fleet-engine/essentials/trip-intro#trip_status_and_remaining_vehicle_waypoints) in\nthe **Introduction to trips** guide.\n\nHere is an example of the `remaining_waypoints` field for a trip, Trip A:\n\n|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| | \\[0\\] | location.point = trip.pickup_point.point || | \\[0\\] | | \\[0\\] | | \\[0\\] | | \\[0\\] | | \\[0\\] | | \\[0\\] | | \\[0\\] | | \\[0\\] | | \\[0\\] | | \\[0\\] | | \\[0\\] | |-------------------------------|-------------------------------------------|---| | `trip_id` = \"trip_A\" || | `waypoint_type` = `PICKUP_WAYPOINT_TYPE` || | path_to_waypoint = LatLng\\[\\] | 1st LatLng from remaining path to pickup | | path_to_waypoint = LatLng\\[\\] | 2nd LatLng from remaining path to pickup | | path_to_waypoint = LatLng\\[\\] | ... | | path_to_waypoint = LatLng\\[\\] | last LatLng from remaining path to pickup | | path_to_waypoint = LatLng\\[\\] | pickup_point, if different from last | | traffic_data || | distance_meters = distance from current vehicle_location along path_to_waypoint to pickup || | eta = updated ETA || | duration = updated duration || |\n| | \\[1\\] | location.point = trip.dropoff_point.point || | \\[1\\] | | \\[1\\] | | \\[1\\] | | \\[1\\] | | \\[1\\] | | \\[1\\] | | \\[1\\] | | \\[1\\] | | \\[1\\] | | \\[1\\] | | \\[1\\] | |-------------------------------|---------------------------------------|---| | trip_id = \"trip_A\" || | waypoint_type = DROP_OFF_WAYPOINT_TYPE || | path_to_waypoint = LatLng\\[\\] | 1st LatLng from dropoff leg | | path_to_waypoint = LatLng\\[\\] | 2nd LatLng from dropoff leg | | path_to_waypoint = LatLng\\[\\] | ... | | path_to_waypoint = LatLng\\[\\] | last LatLng from dropoff leg | | path_to_waypoint = LatLng\\[\\] | dropoff_point, if different from last | | traffic_data || | distance_meters = distance from pickup along path_to_waypoint to dropoff || | eta = updated ETA || | duration = drop-off leg duration || |\n\nWith back-to-back and shared pooling trips, this list may contain waypoints\nfrom other trips to be traversed before this journey. For example, consider\nthe scenario where Trip B is assigned to the same vehicle as Trip A. The\n`remaining_waypoints` field for Trip A would then be populated as follows.\nMost of the fields have been omitted for conciseness, but they would be\npopulated consistent with the previous example.\n\n| \\[0\\] | trip_id = \"trip_A\" |\n| \\[0\\] |\n|----------------------------------------|----------------------------------------|\n| waypoint_type = PICKUP_WAYPOINT_TYPE |\n| \\[1\\] | trip_id = \"trip_B\" |\n| \\[1\\] | waypoint_type = PICKUP_WAYPOINT_TYPE |\n| \\[2\\] | trip_id = \"trip_B\" |\n| \\[2\\] | waypoint_type = DROP_OFF_WAYPOINT_TYPE |\n| waypoint_type = DROP_OFF_WAYPOINT_TYPE |\n\nTrip B's `remaining_waypoint` field would be populated similarly, but only the\nfirst three entries would be present, since Trip A's drop-off point is not part\nof Trip B's route.\n| **Note:** Carefully consider privacy implications when displaying waypoints of trips other than the current user's."]]