停用位置信息更新
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
当司机完成班次后,您可以通过将 locationTrackingEnabled
设置为 false
来停用位置信息更新并使车辆离线。
停用位置信息更新功能还会向 Fleet Engine 发送最终的车辆更新请求,以将车辆状态设置为 GMTDVehicleState.offline
。
如需了解停用位置更新时处理失败的特殊注意事项,请参阅 updateVehicleState
。
Swift
vehicleReporter.locationTrackingEnabled = false
Objective-C
_vehicleReporter.locationTrackingEnabled = NO;
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-31。
[null,null,["最后更新时间 (UTC):2025-08-31。"],[[["\u003cp\u003eSetting \u003ccode\u003elocationTrackingEnabled\u003c/code\u003e to \u003ccode\u003efalse\u003c/code\u003e disables location updates and takes the vehicle offline when the driver ends their shift.\u003c/p\u003e\n"],["\u003cp\u003eDisabling location updates automatically sets the vehicle state to \u003ccode\u003eGMTDVehicleState.offline\u003c/code\u003e in Fleet Engine.\u003c/p\u003e\n"],["\u003cp\u003eRefer to the \u003ccode\u003eupdateVehicleState\u003c/code\u003e documentation for handling potential failures when disabling location updates.\u003c/p\u003e\n"]]],[],null,["# Disable location updates\n\nWhen the driver finishes their shift, you can disable location updates and take\nthe vehicle offline by setting `locationTrackingEnabled` to `false`.\n\nDisabling location updates also sends a final vehicle update request to Fleet\nEngine to set the vehicle state to `GMTDVehicleState.offline`.\n\nFor special considerations on handling failures when disabling location updates,\nsee\n[`updateVehicleState`](/maps/documentation/mobility/driver-sdk/on-demand/reference/ios/interface_g_m_t_d_vehicle_reporter). \n\n### Swift\n\n vehicleReporter.locationTrackingEnabled = false\n\n### Objective-C\n\n _vehicleReporter.locationTrackingEnabled = NO;"]]