Geo Tracking - Specs

Remote configuration

How distance, interval, and pause settings reach native services from the dashboard while preserving local consent.

Each device has a versioned configuration on the server. The administrator changes the distance filter, desired interval, and remote permission to collect; the native service receives these values during its next HTTP synchronization.

Fields and defaults

{
  "version": 1,
  "tracking": {
    "enabled": true,
    "distanceFilterMeters": 10,
    "intervalSeconds": 5
  }
}
FieldDefaultAllowed rangeEffect
version1Positive integerIdentifies the configuration; the server increments it on every update.
enabledtrueBooleanAllows or pauses collection within a locally authorized session.
distanceFilterMeters10 m0 to 1000 mMovement filter requested from the native provider.
intervalSeconds5 sInteger from 1 to 300 sDesired update interval; not a guaranteed deadline.

The API accepts fractional distances within this range, although the current dashboard form uses a 1-meter step. Extra fields are rejected. Updates send only the tracking object; the client does not choose the next version.

From dashboard to device

  1. The operator selects a device on the map and sends PUT /api/devices/:deviceId/config with administrator credentials.
  2. The Durable Object increments the version and writes the configuration in a SQLite transaction.
  3. WebSockets for that device receive a config message, updating connected dashboards.
  4. The native service receives the configuration through GET .../config when there is no batch to upload, or in the config field of the ACK from POST .../locations.
  5. The client validates the values, persists the configuration, and applies versions equal to or higher than the version it already knows.

The WebSocket does not send commands directly to the app. A “configuration saved” message confirms persistence on the server; applying it on the device depends on connectivity, native execution, and synchronization. An offline app continues using its last persisted configuration until it can query the server.

Each new event records configVersion at capture time. Events already in the queue retain their original version, even if they arrive after a change. The ACK returns the current configuration without requiring those older events to be rewritten.

The app distinguishes authorized, which represents a locally started session, from enabled, which indicates active collection according to native state.

SituationExpected result
App configured but never started locallyA remote configuration with enabled: true does not start collection.
Local session authorized and collection allowed remotelyCollection can run if permissions, service, and storage are available.
Local session authorized and collection paused remotelyCollection pauses; local authorization is retained.
Remote configuration allows collection again for a still-authorized local sessionCollection may resume when the configuration arrives and native requirements are met.
User taps Stop trackingLocal authorization is revoked; another remote update cannot restart collection on its own.

The stop button remains available while local authorization exists, including during a remote pause. Stopping collection does not delete history or the queue. Pending samples can still be synchronized; configuration controls collection and does not revoke upload credentials.

Applying settings on Android

TrackingEngine uses a dedicated executor and runs one synchronization at a time. While an authorized session or pending queue exists, a periodic task attempts synchronization every 15 seconds. Captures, manual actions, and restored connectivity also trigger attempts. Transport errors use progressively longer delays, capped at five minutes.

TrackingForegroundService applies interval and distance settings to the LocationRequest used by FusedLocationProviderClient. Collection depends on the foreground service and permissions. A remote pause preserves session authorization, allowing later configurations to arrive while the process and services continue running.

These intervals describe running code, not guaranteed scheduling after a force-stop, process termination, or manufacturer restrictions. See Android.

Applying settings on iOS

GeoTrackingService configures CLLocationManager.distanceFilter and filters captures by the minimum interval between timestamps. Collection requires Always authorization, the background location capability, an authorized local session, a remote configuration that allows collection, and usable storage.

A native timer checks whether synchronization is needed every two seconds while the process is running. With an empty queue, a successful synchronization schedules the next configuration query for ten seconds later. Returning to the active state and restored connectivity also trigger attempts. Failures use progressively longer delays with a small random variation, capped at approximately five minutes.

If a pause stops location updates and iOS suspends the process, the timer does not guarantee a background query. A later remote setting that allows collection may depend on the app running again. The backend does not implement push notifications to wake the app. See iOS.

Concurrent edits and dashboard updates

The server serializes updates and assigns increasing versions, including for concurrent requests. There is no version precondition or partial update: each PUT replaces the full set of settings, and the last write determines the current values.

The dashboard ignores older configurations. Once the user starts editing the form, incoming events do not automatically overwrite those fields; after saving, the form receives the confirmed response. Session activity shows the new version and received settings.

Configuration scope

This configuration belongs to continuous tracking and does not change polygons, inside/outside classification, geometry, or the monitoring event queue. Those features have their own local configuration, described in Polygons and monitoring.

Distance and interval settings are not measurements of battery savings. Comparing consumption, latency, and consistency during real operation requires a Field test.

Sources and tests

Sources: tracking-server/src/validation.ts, tracking-server/src/index.ts, tracking-server/public/app.js, geo-demo/modules/geo-monitoring/android/src/main/java/expo/modules/geomonitoring/TrackingEngine.kt, geo-demo/modules/geo-monitoring/android/src/main/java/expo/modules/geomonitoring/TrackingForegroundService.kt, and geo-demo/modules/geo-monitoring/ios/GeoTrackingService.swift.

The server test covers validation, concurrent version increments, WebSocket delivery, and inclusion of configuration in the ACK. Android tests include TrackingRemoteConfig validation. These tests do not demonstrate how quickly a suspended device applies configuration changes.

On this page