Menu

Location-verified task flows with Firebase
📰

Location-verified task flows with Firebase

DEV Community: firebase·Dogukan Kardas·1 day ago
#HlDoieQA
#devtofirebase#devto#dev#started#resource
Reading 0:00
15s threshold

EV SLA manages field technician tasks where "I started the job" must mean "I am physically at the site". This post covers the geofence check, the realtime state machine, and what happens when connectivity drops mid-shift.

The geofence check

Each task carries the site coordinates and an allowed radius. On "start job", the client captures a GPS fix and the check runs with the haversine distance. The radius adapts to reported GPS accuracy so technicians in dense urban areas are not falsely rejected.

Haversine distance with accuracy-aware radius

function canStartJob ( task : Task , fix : GeoFix ): boolean { const distanceM = haversine ( task . site , fix . coords ); // Widen the fence by the GPS accuracy, capped to avoid abuse const tolerance = Math . min ( fix . accuracyM , MAX_ACCURACY_BONUS_M ); return distanceM <= task .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.