Get started
Color

Live positions, tracking consent and gaps

Upload driver positions safely, keep tracking to shifts and trips, read the live list and spot gaps in a track.

For
OwnerFleet managerDriver
Hosting
Any hosting
Devices
All devices
Business
Fleet

Checked against Pop Dispatch 0.1.0

You will be able to send positions from a driver's phone in batches, rely on tracking running only while the driver is on a shift or a trip, read the last known position of every active asset, and see where a track has gaps. The map screen arrives with the web console; the list at /fleet/live is available now.

The Live map screen in the web console for the demo business.
The Live map screen.

Before you start #

  • The dispatch_fleet license flag is on. Every Pop Dispatch license includes Fleet, and the trial runs for 30 days.
  • The driver or asset exists. The driver's profile is marked on shift, or a trip is running.
  • Each device has a stable device_id, and each position has a seq number that rises with every position that device sends.

Steps #

  1. Send POST /fleet/positions with device_id, exactly one of asset_id or person_id, and fixes, a list of 1 to 1000 positions. Add trip_id and a source of phone (default), http_tracker or hardware.
  2. Give each fix seq, lat, lng and recorded_at. You can add accuracy_m, speed_cm_s and heading_deg.
  3. Read the answer: accepted, duplicates, a rejected list with a reason for each, and tracking, which says whether the subject is on shift and whether a trip is active.
  4. Send the same batch again if the connection dropped. Positions with a device_id and seq Pop Dispatch already holds are counted as duplicates and stored once.
  5. Read the last known position of every active asset with GET /fleet/live.
  6. Read a track with GET /fleet/assets/:id/positions, with optional from and to. The default is the last 24 hours.

Tracking only during a shift or a trip #

A position is stored only while the driver is on a shift or a trip is running for the driver or asset. At any other time the fix is rejected with the message "Tracking runs only during a shift or a trip." The tracking block in every answer reports the current state, so the driver app can show the driver that tracking is on or off at that moment. The Fleet screens for this arrive with the web console.

A fix is also rejected when the position is outside the range of Earth (a latitude beyond 90 or a longitude beyond 180) or when the device or sequence number is missing ("A position needs a device and a sequence number.").

Gaps #

A gap is a stretch longer than 5 minutes between two stored positions. A phone that lost signal leaves a gap, and the track response returns the number of gaps. A gap marks missing positions. Pop Dispatch draws no line across it as if the vehicle had been seen there.

Distance from positions #

The track response includes estimated_distance_m, worked out along the track from fixes whose accuracy is 100 m or better. It is an estimate for the screen. It never writes the odometer, so the odometer and the cost reports keep using meter readings.

Technical details
  • Uniqueness is on tenant, device_id and seq, so a repeat is dropped by the database.
  • The newest fix in a batch updates the last known position of the asset or driver profile, only when it is newer than the one stored.
  • Live reads list active operator assets that have a stored position, with unit_no, label, lat, lng and last_ping_at.
  • A track answer holds up to 5000 positions for the period.
  • A trip's gps_distance_m is stored as given and shown as an estimate.

If something goes wrong #

  • feature_not_licensed (403), licence_read_only (403): uploads stop until the flag or license is restored.
  • validation_failed (422): both or neither of asset_id and person_id were sent, source is unknown, fixes is empty or above 1000, or device_id is missing.
  • not_found (404): the asset, person or trip does not exist.
  • Every fix is in rejected with the tracking message: start the trip or put the driver on shift, then send the batch again. The rejected positions were not stored.