Field Staff Tracking
GPS Tracking
Live Location Tracking

Live Location Tracking

Beyond check-in and check-out, the system continuously tracks field staff location throughout their duty period. The mobile app sends periodic GPS waypoints that are stored as detail records linked to the active site visit.

Continuous Tracking Flow

Safety Check: Only Track Active Sessions

The system performs a critical check before storing any location data. It first looks up the current day's mobile attendance record for the user. Location is only recorded if:

  1. A mobile attendance record exists for today
  2. The OutDateAndTime field is still null (meaning the user hasn't clocked out yet)

This prevents stale location data from being recorded after a user has already ended their duty.

DataTable dt = objBO.GetMyTodayMobileAttendanceId(UserId);
bool lProoceedToAdd = false;
 
if (dt.Rows.Count > 0)
    lProoceedToAdd = SHGeneral.GetDate(dt.Rows[0]["OutDateAndTime"])
        .ToString("dd-MM-yyyy") == "01-01-0001" ? true : false;

The check compares the OutDateAndTime against the default date 01-01-0001 — if it matches, the session is still active.

Device Metadata Captured

Each location update includes device health information:

FieldTypeDescription
BatteryPercentageintCurrent battery level (0-100)
IsGPSOnboolWhether GPS is enabled on device
IsWifiOnboolWhether WiFi is connected
SignalStrengthintMobile network signal strength
AppVersionstringCurrent app version installed

This metadata helps managers identify if a staff member's tracking gaps are due to technical issues (low battery, GPS disabled, poor signal) rather than intentional avoidance.

Site Visit Location Updates

Separate from the continuous background tracking, the app can also send explicit location updates tied to a specific site visit record:

This endpoint (SaveReportOnDutyLocation) inserts a waypoint linked to a specific SiteVisitGPSID, unlike SaveLocationOfUser which operates independently.

Location Service Status

The mobile app also reports its location service status to the server:

GET /webapi/SiteVisitGPS/UpdateLocationServiceStatus?UserId=1234&IsLocationEnabled=true

This allows the admin portal to flag users who have disabled their GPS.

API Endpoints

EndpointMethodPurpose
SaveLocationOfUserPOSTBackground continuous tracking with device metadata
SaveReportOnDutyLocationPOSTExplicit location update tied to a site visit
UpdateLocationServiceStatusGETReport GPS enable/disable status

Source Files

FilePurpose
SiteVisitGPSAPIController.csLocation API endpoints
clsMobileAppServiceInsertUserLocationForRegularTrack, InsertUserCurrentLocation
MyAttendanceBOGetMyTodayMobileAttendanceId check