- A shift is created
- A professional gets assigned a shift
- The professional starts traveling to the shift
- The professional’s live ETA and location updates are recorded
- The professional automatically clocks in upon arrival
- The professional automatically clocks out upon departure
- The professional is reimbursed either by time onsite and/or trip mileage
Features used
Shift lifecycle
Getting started
If you haven’t already, sign up for Radar to get your API keys.Initialize the SDK
For full setup instructions, see the iOS SDK and Android SDK docs. Once the SDK is installed, initialize it.Set the user
When a professional logs in, set their user ID and any relevant metadata. This links all location updates and events to the professional in your system. iOS (Swift)metadata, like companyId, makes it easy to filter the data by company or team on the server side.
Request location permissions
This experience requires background location permissions so the SDK can track the professional’s location when the app is not in the foreground. Following these docs to request background permissions for iOS and Android.Steps
1
Create a geofence for the shift location
When a shift is created, create a geofence for its location. This will be used to detect when the professional arrives and departs.Use the Geofences API to create a geofence server-side when a shift is created. Link the geofence to the shift using an
externalId so you can reference it. Setting deleteAfter automatically deletes the geofence after the shift window, keeping your project clean without requiring a manual delete call. 2
Start a trip when the professional begins traveling
When the professional taps “Start route,” start a Radar trip. Trips provide real-time ETA tracking, delay detection, and approaching signals - everything needed to power a live tracking view for a dispatcher or customer.iOS (Swift)Android (Kotlin)Setting
scheduledArrivalAt enables Radar’s delay detection: if the professional’s ETA exceeds the scheduled arrival time, Radar will automatically surface a delay signal. We recommend implementing silent push notifications alongside trip tracking to ensure location updates continue even if the professional manually terminates the app.Tracking frequencyRadar’s SDK supports custom tracking options as well as three tracking presets: EFFICIENT, RESPONSIVE, and CONTINUOUS. You can remotely set tracking options in the Radar dashboard, overriding any client-side specified tracking options.In addition to general tracking options, Radar supports overriding tracking behavior during a trip or inside a geofence with a specified tag.As a professional is on their way to a shift, we recommend:- On-trip tracking options: increase tracking frequency while a professional is actively on a trip using a modified version of the
CONTINUOUSpreset, withdesiredStoppedUpdateInterval: 60anddesiredMovingUpdateInterval: 60. - In-geofence tracking options: increase tracking frequency to every 30s via the base
CONTINUOUSpreset when a professional is inside ashiftgeofence to ensure accurate clock-in/out detection while on-site.
3
Handle trip signals
Trips stream real-time locations and ETA updates to your backend via webhooks. Use these events to power a dispatcher dashboard and/or customer-facing tracking view.Key trip events to listen for:
Offline behavior: If the professional loses connection during a trip, the SDK will buffer location updates and replay them once connectivity is restored. Your backend will receive the replayed locations in order, so no location data should be lost.No-show detection: As the professional travels,
eta.duration is updated on each user.updated_trip event. If the ETA continues to increase over time rather than decrease, this may indicate the professional is moving away from the shift. You can implement custom no-show logic on your backend by tracking ETA trends across successive events and marking a shift as a no-show after a configurable threshold.Example user.updated_trip payload:4
Clock-in on geofence entry
When the professional enters the shift geofence, Radar triggers a Update the shift record in your system with the clock-in timestamp.
user.entered_geofence event. Use createdAt from the webhook payload at the clock-in timestamp.5
Clock-out on geofence exit
When the professional exits the shift geofence, Radar triggers a Time onsite =
user.exited_geofence event. Use createdAt as the clock-out timestamp and calculate the time onsite.exitedAt - enteredAt6
Calculate mileage for reimbursement
When the trip completes, pass it to Radar’s route matching API to calculate the distance traveled for mileage reimbursement.Request:Response:Use
distance.text to display the trip mileage to the dispatcher and distance.value to calculate reimbursement.