سفر درخواستی چیست؟
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
مستندات این بخش نحوه ایجاد و کار با سفرها را با استفاده از سرویس سفرهای درخواستی Google Maps Mobility نشان می دهد. مستلزم آشنایی با موارد زیر است:
TripService
که استفاده می کنید برای gRPC و REST در دسترس است. برای سادگی، مراجع میدانی از قرارداد gRPC پیروی می کنند.
در Fleet Engine برای خدمات درخواستی، سفر نوعی سفر است که برآورده شدن درخواست تحویل غذا یا سواری از سوی مصرف کنندگان شما را مدل می کند. یک سفر دارای وضعیتی است که شما با تکامل سفر به Fleet Engine گزارش می دهید، مانند NEW
، ENROUTE_TO_PICKUP
و موارد دیگر. وضعیت سفر مربوط به ایستگاههای بین مکانی تعیینشده به وسیله نقلیه است، و Fleet Engine با هر بهروزرسانی سفری که انجام میدهید، این نقاط بین خودرو را تغییر میدهد. برای اطلاعات بیشتر در مورد سفرها و ارتباط آنها با وسایل نقلیه، به سفرهای درخواستی در موارد ضروری Fleet Engine مراجعه کنید.
زندگی یک سفر
برای ردیابی هر سفر در Fleet Engine، ابتدا باید یک موجودیت Trip
ایجاد کنید. برای مرجع به gRPC یا REST مراجعه کنید.
جدول زیر نمونه ای از جریان سرتاسر سفر ایجاد شده در سیستم شما و مراحل چرخه عمر آن در Fleet Engine را شرح می دهد. فرض میکند که Fleet Engine را راهاندازی کردهاید و وسیله نقلیهای برای اختصاص دادن به سفر دارید و بهروزرسانیهای مکان در برنامه راننده فعال است. به Driver SDK: سفرهای درخواستی مراجعه کنید.
1 | دریافت درخواست رزرو | قبل از شروع سفر Fleet Engine، سیستم رزرو شما ابتدا درخواستی برای سواری یا تحویل از مصرف کننده از طریق برنامه شما یا سایر سیستم های رزرو دریافت می کند. سپس سیستم شما موجودیت سفر را با استفاده از CreateTrip با فیلدهای مورد نیاز، مانند مکان تحویل، ایجاد می کند. همچنین میتواند فیلدهای دیگری را در این نقطه تنظیم کند، مانند مسافران و محل خروج، یا صبر کند تا وسیله نقلیه را تعیین کند. به ایجاد یک سفر تک مقصدی رجوع کنید. |
2 | وسیله نقلیه را اختصاص دهید | میتوانید وسایل نقلیه را مستقیماً در سیستم خود به سفرها اختصاص دهید و آن را به Fleet Engine گزارش دهید، یا میتوانید از سرویس Search Vehicle برای جستجوی وسایل نقلیه استفاده کنید، با فیلتر کردن هر دو ویژگی سفر و وسیله نقلیه برای یافتن بهترین وسیله نقلیه برای تکمیل سفر. هر وسیله نقلیه آنلاین در شعاع جستجوی شما، نزدیکی خود را از طریق بهروزرسانیهای مکان ارائه شده توسط Driver SDK مشخص میکند. هنگامی که SearchVehicle وسیله نقلیه ای را که شما آن را به یک سفر مطابقت می دهید برمی گرداند، سیستم شما با نقطه پایانی UpdateTrip تماس می گیرد تا شناسه وسیله نقلیه ای را که به سفر NEW اختصاص داده اید گزارش کند. |
3 | به روز رسانی سفر | هنگامی که راننده سفر را پذیرفت و حرکت به محل تحویل را آغاز کرد، سیستم شما وضعیت سفر را از NEW به ENROUTE_TO_PICKUP به روز می کند. شما همچنان به نظرسنجی مکان وسیله نقلیه در طول سفر ادامه میدهید، یا از طریق اتصال مستقیم از برنامه به باطن خود، یا با نظرسنجی Fleet Engine، که جریانی مداوم از بهروزرسانیهای مکان خودرو را از Driver SDK دریافت میکند. سپس سیستم شما هر نقطه عطف سفر را به Fleet Engine گزارش میکند، که لیست نقاط بین راه خودرو را بر این اساس بهروزرسانی میکند. |
4 | سفر را با مصرف کننده به اشتراک بگذارید | Fleet Engine جزئیات سفر و مکان وسیله نقلیه را در دسترس Consumer SDK قرار میدهد، که از شنونده برای دریافت بهروزرسانیهای سفر و نمایش آنها در برنامه مصرفکننده استفاده میکند. Fleet Engine بهطور خودکار ETA، مسافت باقیمانده، مسیرها و ایستگاههای بین راهی خودرو را بهروزرسانی میکند. برای اطلاعات بیشتر به اشتراک سفرها برای سفرهای درخواستی مراجعه کنید. |
5 | سفر کامل | هنگامی که وسیله نقلیه به مقصد سفر رسید و راننده شما یک سفر موفق را نشان داد، سیستم شما وضعیت TripStatus را در Fleet Engine روی COMPLETE تنظیم می کند. به خاطر داشته باشید که مانند وسایل نقلیه، اشخاص سفر بدون در نظر گرفتن وضعیت به مدت 7 روز در Fleet Engine فعال میمانند و در این مرحله حذف میشوند. |
جریان توالی سفر
نمودار زیر نمای دقیق تری از این جریان را نشان می دهد.

بعدش چی
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-08-29 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-08-29 بهوقت ساعت هماهنگ جهانی."],[[["\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)"]]