Update Frequency and Battery Optimization Strategies
Update Frequency Trade-offs
Higher frequency means more accurate position but more battery drain, network usage, and server load. Lower frequency saves resources but positions become stale. The right frequency depends on use case.
Package tracking: update every few minutes. Packages move slowly and exact position matters less. Ride tracking during trip: update every 2-5 seconds. Rider wants accurate ETA. Driver matching: update every 5-15 seconds. Need reasonable proximity but not GPS precision.
Battery Optimization Strategies
Significant location change: Only send update when position changes meaningfully. Moving 10 meters while parked does not need server update. OS-level APIs provide this filtering.
Adaptive frequency: Update frequently when moving, rarely when stationary. Detect motion state from accelerometer. Stopped driver updates once per minute. Moving driver updates every 5 seconds.
Geofence triggers: Instead of continuous tracking, register geofences at key locations. Update server only when entering or leaving a geofence. Reduces updates dramatically for predictable routes.
Bandwidth Optimization
Each update is small (lat, lon, timestamp, entity ID) but millions of updates add up. Batch updates when possible: collect positions for 5 seconds, send once. Use binary protocol instead of JSON. Compress repeated headers in HTTP/2.
Delta encoding: send only changed fields. If entity ID is implicit from connection, do not send it. If timestamp is implicit from server receipt time, do not send it. Minimal payload: 8 bytes for lat/lon pair.