使用方 SDK 计划任务概览
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
通过允许消费者跟踪其预定的送货或服务订单的进度,为预定任务量身定制消费者体验。
什么是用于预定任务的 Consumer SDK?
Consumer SDK 是 Fleet Engine 的一项功能,适用于预定任务,还包含用于打造消费者体验的工具包。借助这些工具包,您可以创建基于地图的显示界面,直观呈现司机的行程进度,并显示与预定停靠点关联的任务的状态。本指南面向两大主要受众群体:
- 希望了解单个货件订单的配送状态的消费者最终用户。本文档介绍了如何使用 JavaScript 中的 Consumer SDK 实现这种消费者体验,该 SDK 提供
FleetEngineShipmentLocationProvider
类和关联的接口。
- 希望跟踪整个车队的送货和车辆状态的车队运营商。如需了解如何跟踪车队,请参阅车队跟踪指南。

为何要使用 Consumer SDK 来执行预定任务?
将 Consumer SDK 集成到预定任务的消费者应用中,可让您提供全面的消费者体验,包括近乎实时的位置更新和贴合道路的位置。您的消费者可以查看送货车辆的位置和进度详情,从而了解其货件的所在位置。
Consumer SDK 可用于哪些用途?
使用 Consumer SDK 与消费者分享以下配送信息:
- 地图上配送车辆的实时位置。
- 包裹送达的预计时间,会根据交通状况等变化进行调整。
- 车辆正在行驶的路线。
- 在包裹送达之前,配送员还需行驶的距离和停靠的站数。
您还可以根据 Driver SDK 中的位置信息,在您的消费者应用或网站中打造其他无缝的地理位置相关消费者体验。如需详细了解 Driver SDK,请参阅 Driver SDK 预定任务概览。
Consumer SDK 组件
JavaScript Consumer SDK 包含以下组件:
- 一个 JavaScript 地图组件,可直接替换标准
google.maps.Map
实体。
- 要与 Fleet Engine 连接的数据组件。
- 用于可视化显示车辆和路线(随着车辆向目的地前进)。
- 用于计算司机预计到达时间或剩余行驶距离的原始数据 Feed。
下表介绍了各个组件。
组件 |
说明 |
地图视图 |
地图视图会显示车辆的行驶进度,并随着车辆沿路线行驶而更新视图。 |
货件位置信息提供方 |
货运跟踪服务提供商提供位置信息 Feed,以便地图可以显示有关货运的实用信息,例如货运的取货或送货地点以及送货车辆的位置和路线。
|
身份验证令牌提取器 |
身份验证令牌提取器从后端服务器获取 JSON Web 令牌 (JWT),以验证对存储在 Fleet Engine 中的位置数据的访问权限。您可以使用 JavaScript 旅程分享库在 Web 应用中实现身份验证令牌提取器。请注意,您还必须在后端服务器上为 Fleet Engine 实现 JSON Web 令牌 (JWT) 创建服务。 |
地图样式选项 |
您可以使用自定义样式选项更改地图的默认样式,使其与 Web 应用的样式相符。 |
如何使用 Consumer SDK
后续步骤
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-31。
[null,null,["最后更新时间 (UTC):2025-08-31。"],[[["\u003cp\u003eThe Consumer SDK enables businesses to provide customers with real-time visibility into the location and progress of their scheduled deliveries or service orders.\u003c/p\u003e\n"],["\u003cp\u003eThis SDK offers tools for creating map-based displays within consumer applications, showing the driver's location, estimated time of arrival, and route information.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can integrate the Consumer SDK to create a comprehensive and seamless delivery tracking experience for their customers, improving transparency and satisfaction.\u003c/p\u003e\n"],["\u003cp\u003eKey components of the SDK include a map view, a location provider, authentication mechanisms, and customizable styling options to tailor the experience.\u003c/p\u003e\n"],["\u003cp\u003eTo begin, developers need to set up the JavaScript Consumer SDK, follow a specific shipment for tracking, and customize the map interface as desired.\u003c/p\u003e\n"]]],[],null,["Tailor the consumer experience for scheduled tasks by allowing consumers to\nfollow the progress of their scheduled deliveries or service orders.\n\nWhat is the Consumer SDK for scheduled tasks?\n\nThe Consumer SDK is a feature of Fleet Engine for scheduled tasks that also\nincludes toolkits to create the consumer experience. These toolkits let you\ncreate map-based displays to visualize a driver's\nprogress and show the status of the task associated with a scheduled stop. It's\ndesigned for two primary audiences:\n\n- **Consumer end users** who want to know delivery status for an individual shipment order. This document covers how to implement that consumer experience with the Consumer SDK in JavaScript, which provides the `FleetEngineShipmentLocationProvider` class and associated interfaces.\n- **Fleet operators** who want to track the delivery and vehicle status for an entire fleet of vehicles. For information about tracking fleets, see the [Fleet tracking guide](/maps/documentation/mobility/operations/fleet-tracking).\n\nWhy use the Consumer SDK for scheduled tasks?\n\nIntegrating the Consumer SDK into your scheduled tasks consumer applications\nlets you provide a comprehensive consumer experience, with near real-time\nlocation updates and road-snapped positions. Your consumers can see the delivery\nvehicle's location and progress details that help them understand where their\nshipment is.\n\nWhat can you do with the Consumer SDK?\n\nUse the Consumer SDK to share the following shipment information with your\nconsumers:\n\n- Delivery vehicle's real-time position on a map.\n- ETA for package arrival, adjusted for changing circumstances, such as traffic.\n- Route the vehicle is taking.\n- Distance and number of stops remaining before their shipment is delivered.\n\nYou can also create other seamless geo-enabled consumer experiences inside your\nconsumer app or website based on location information from the Driver SDK. For\ndetails about the Driver SDK, see the\n[Driver SDK scheduled tasks overview](/maps/documentation/mobility/driver-sdk/scheduled).\n\nConsumer SDK components\n\nThe JavaScript Consumer SDK contains the following components:\n\n- A JavaScript map component that is a drop-in replacement for a standard `google.maps.Map` entity.\n- Data components to connect with Fleet Engine.\n- Components for visualization of the vehicle and route as it progresses to a destination.\n- Raw data feeds for a driver's ETA or the remaining distance to drive.\n\nThe following table describes the components.\n\n| Component | Description |\n|------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Map view | The map view illustrates the progress of the vehicle, updating the view as the vehicle moves along its route. |\n| Shipment location provider | The shipment tracking provider provides a location feed so that the map can display useful information about the shipment, such as the pickup or delivery location of the shipment and the location and route of the delivery vehicle. |\n| Authentication token fetcher | The authentication token fetcher gets JSON Web Tokens (JWTs) from your backend server to authenticate access to the location data stored in Fleet Engine. You implement an authentication token fetcher as part of your web application using the JavaScript Journey Sharing Library. Note that you must also implement a JSON Web Token (JWT) creation service for Fleet Engine on your backend server. |\n| Map style options | You can use custom styling options to change the default styling of your map to match the styling of your web application. |\n\nHow to use the Consumer SDK\n\n|---|----------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| 1 | **Set up the JavaScript Consumer SDK** | For more information, see [Set up the JavaScript Consumer SDK](/maps/documentation/mobility/journey-sharing/scheduled/shipment-tracking/setup). |\n| 2 | **Follow a shipment** | Learn how to initialize the map, start following a shipment, and stop following with appropriate clean up. See [Follow a shipment](/maps/documentation/mobility/journey-sharing/scheduled/shipment-tracking/follow). |\n| 3 | **Customize the map interface** | You can use the JavaScript Consumer SDK for scheduled tasks to customize the map interface, provide marker customization, or style polylines. See [Style a map](/maps/documentation/mobility/journey-sharing/scheduled/shipment-tracking/style-map), [Customize markers](/maps/documentation/mobility/journey-sharing/scheduled/shipment-tracking/customize-markers), and [Customize polylines](/maps/documentation/mobility/journey-sharing/scheduled/shipment-tracking/customize-polylines). |\n\nWhat's next\n\n- [Set up the JavaScript Consumer SDK](/maps/documentation/mobility/journey-sharing/scheduled/shipment-tracking/setup)"]]