Skip to main content

Overview

RadarTrackingOptions allows you to configure how the Radar SDK tracks location in the background. You can use preset configurations optimized for different use cases or create custom options to fine-tune tracking behavior.

Presets

Radar provides three preset tracking options optimized for common scenarios:

Continuous

Updates about every 30 seconds while moving or stopped. Moderate battery usage. Shows the flashing blue status bar during tracking.
Radar.startTracking(trackingOptions: .presetContinuous)
Configuration:
  • desiredStoppedUpdateInterval: 30 seconds
  • desiredMovingUpdateInterval: 30 seconds
  • desiredAccuracy: High
  • showBlueBar: true
  • useStoppedGeofence: false
  • useMovingGeofence: false
  • useVisits: false

Responsive

Updates about every 2.5 minutes when moving and shuts down when stopped to save battery. Once stopped, the device will need to move more than 100 meters to wake up and start moving again. Low battery usage.
Radar.startTracking(trackingOptions: .presetResponsive)
Configuration:
  • desiredStoppedUpdateInterval: 0 (shuts down when stopped)
  • desiredMovingUpdateInterval: 150 seconds
  • desiredAccuracy: Medium
  • showBlueBar: false
  • useStoppedGeofence: true with 100m radius
  • useMovingGeofence: true with 100m radius
  • useVisits: true
  • useSignificantLocationChanges: true
Location updates may be delayed significantly by Low Power Mode, or if the device has connectivity issues, low battery, or Wi-Fi disabled.

Efficient

Uses the iOS visit monitoring service to update only on stops and exits. Once stopped, the device will need to move several hundred meters and trigger a visit departure to wake up and start moving again. Lowest battery usage.
Radar.startTracking(trackingOptions: .presetEfficient)
Configuration:
  • desiredStoppedUpdateInterval: 0
  • desiredMovingUpdateInterval: 0
  • desiredAccuracy: Medium
  • useVisits: true
  • syncGeofences: true
  • replay: Stops
This preset is ideal for applications that only need to know about significant location changes, such as arrival and departure events.

Custom Options

You can create custom tracking options by initializing a RadarTrackingOptions object and setting individual properties:
let options = RadarTrackingOptions()
options.desiredStoppedUpdateInterval = 0
options.desiredMovingUpdateInterval = 120
options.desiredSyncInterval = 20
options.desiredAccuracy = .medium
options.stopDuration = 140
options.stopDistance = 70
options.syncLocations = .all
options.showBlueBar = false
options.useStoppedGeofence = true
options.stoppedGeofenceRadius = 100
options.syncGeofences = true

Radar.startTracking(trackingOptions: options)

Configuration Properties

Update Intervals

Determines the desired location update interval in seconds when stopped. Set to 0 to shut down when stopped.Type: Int
Location updates may be delayed significantly by Low Power Mode, or if the device has connectivity issues, low battery, or Wi-Fi disabled.
Determines the desired location update interval in seconds when moving.Type: Int
Determines the desired sync interval in seconds for sending location updates to the server.Type: Int

Accuracy

Determines the desired accuracy of location updates.Type: RadarTrackingOptionsDesiredAccuracyOptions:
  • .high - Uses kCLLocationAccuracyBest
  • .medium - Uses kCLLocationAccuracyHundredMeters (default)
  • .low - Uses kCLLocationAccuracyKilometer

Stop Detection

With stopDistance, determines the duration in seconds after which the device is considered stopped.Type: Int
With stopDuration, determines the distance in meters within which the device is considered stopped.Type: Int

Scheduling

Determines when to start tracking. Use nil to start tracking immediately when startTracking() is called.Type: Date?
let options = RadarTrackingOptions.presetResponsive
options.startTrackingAfter = Date().addingTimeInterval(3600) // Start in 1 hour
Radar.startTracking(trackingOptions: options)
Determines when to stop tracking. Use nil to track until stopTracking() is called.Type: Date?
let options = RadarTrackingOptions.presetResponsive
options.stopTrackingAfter = Date().addingTimeInterval(86400) // Stop in 24 hours
Radar.startTracking(trackingOptions: options)

Sync Options

Determines which location updates to sync to the server.Type: RadarTrackingOptionsSyncLocationsOptions:
  • .all - Syncs all location updates (default)
  • .stopsAndExits - Syncs only stops and exits
  • .none - Syncs no location updates
Determines which failed location updates to replay to the server when connectivity is restored.Type: RadarTrackingOptionsReplayOptions:
  • .stops - Replays failed stops
  • .none - Replays no failed location updates
  • .all - Replays all failed location updates

iOS Services

Determines whether to use iOS region monitoring to create a client geofence around the device’s current location when stopped.Type: BoolSee Apple’s documentation for more information.
Determines the radius in meters of the client geofence around the device’s current location when stopped.Type: Int
Determines whether to use iOS region monitoring to create a client geofence around the device’s current location when moving.Type: Bool
Determines the radius in meters of the client geofence around the device’s current location when moving.Type: Int
Determines whether to use the iOS visit monitoring service for detecting significant location changes.Type: BoolSee Apple’s documentation for more information.
Determines whether to use the iOS significant location change service.Type: BoolSee Apple’s documentation for more information.
Determines whether the flashing blue status bar is shown when tracking in the background.Type: BoolSee Apple’s documentation for more information.

Advanced Options

Determines whether to sync nearby geofences from the server to the client to improve responsiveness.Type: Bool
Determines whether to monitor beacons for proximity detection.Type: Bool
Determines whether to use indoor scanning for improved indoor location accuracy.Type: Bool
Determines whether to use the iOS motion activity service for better movement detection.Type: Bool
Determines whether to use the iOS pressure service for altitude detection.Type: Bool

Getting Current Options

You can retrieve the current tracking options:
let currentOptions = Radar.getTrackingOptions()
print("Desired accuracy: \(currentOptions.desiredAccuracy)")

Battery Optimization

To optimize battery usage while maintaining location accuracy:
1

Choose the right preset

Start with a preset that matches your use case:
  • Use Efficient for geofencing-only applications
  • Use Responsive for delivery or on-demand apps
  • Use Continuous only when real-time tracking is critical
2

Tune update intervals

Increase desiredMovingUpdateInterval to reduce location updates when moving. Set desiredStoppedUpdateInterval to 0 to shut down when stopped.
3

Use geofences

Enable useStoppedGeofence and useMovingGeofence to leverage iOS region monitoring instead of continuous location updates.
4

Lower accuracy when possible

Use .medium or .low accuracy if your use case doesn’t require high precision.
5

Enable iOS services

Enable useVisits and useSignificantLocationChanges to leverage energy-efficient iOS location services.

Best Practices

Start with a preset

Begin with a preset and customize only what you need. Presets are battle-tested for common scenarios.

Test on real devices

Battery impact varies significantly between device models. Test your configuration on actual hardware.

Monitor battery usage

Use Xcode’s Energy Log instrument to measure your app’s energy impact.

Respect Low Power Mode

Location updates are automatically throttled by iOS in Low Power Mode. Design your app to handle delayed updates gracefully.