Vehicle reporter for ridesharing that reports location updates and vehicle online/offline state. An app is allowed only one vehicle reporter.
Nested Class Summary
| enum | RidesharingVehicleReporter.VehicleState | Indicates whether a vehicle is accepting new trips. | |
Public Method Summary
| void |
disableLocationTracking()
Stops location tracking.
Note: Calling this method triggers a last one-off updateVehicle request to Fleet Engine to force the vehicle state to `OFFLINE`. |
| void |
enableLocationTracking()
Start uploading position reports to the Fleet Engine backend.
Note: Once location tracking is enabled again, the vehicle state will remain
`OFFLINE` unless |
| void |
Inherited Method Summary
Public Methods
public void disableLocationTracking ()
Stops location tracking. No attempt is made to stop a report that is already in progress, but no new position reports will be generated or transmitted.
Tracking can be resumed after stopping by calling
enableLocationTracking() again.
Note: Calling this method triggers a last one-off updateVehicle request to Fleet Engine to force the vehicle state to `OFFLINE`.
public void enableLocationTracking ()
Start uploading position reports to the Fleet Engine backend. Reports are made periodically, by default every 10 seconds. Reports may be made less frequently if transient issues, such as loss of network connectivity, prevent report delivery.
Position reports are made in a background thread, this call returns immediately.
Location tracking may be disabled by calling
disableLocationTracking().
Reporting interval can be changed with
setLocationReportingInterval(long, TimeUnit).
Note: Once location tracking is enabled again, the vehicle state will remain
`OFFLINE` unless
setVehicleState(VehicleState) is called.
public void setVehicleState (RidesharingVehicleReporter.VehicleState state)
Sets the VehicleState. If location updates are enabled, the value will propagate at the next location update. If location updates are disabled, the update is fired immediately.
VehicleState update is made in a background thread, this call returns immediately.
Setting VehicleState as online here changes the view of the NavigationView from Map to Navigation (Camera perspective is tilted and blue dot switches to navigation mode).
Throws
| IllegalStateException | if VehicleState is set ONLINE when location tracking is not yet enabled. |
|---|