Skip to content
Support the creatorSupport

Location record

The same object is emitted to JavaScript (onLocation), stored in the queue, and uploaded (unless you set a locationTemplate).

{
"uuid": "6f1c2a1e-8b9e-4c1a-9a43-0d6c1d1a7f10",
"timestamp": "2026-10-26T12:00:00.123Z",
"event": "interval",
"is_moving": true,
"coords": {
"latitude": 43.85,
"longitude": 18.41,
"accuracy": 4.8,
"speed": 12.3,
"heading": 181,
"altitude": 520.4
},
"battery": { "level": 0.82, "is_charging": false },
"mock": false,
"extras": { "driver_id": "D-1042" }
}
Field Type Meaning
uuid string UUID v4, generated when the fix is recorded. Unique per record: use it to deduplicate retries.
timestamp string Time of the fix (not of the upload), ISO 8601 UTC with milliseconds.
event 'interval' | 'motionchange' | 'current' Why it was recorded; see below.
is_moving boolean The moving/parked state when it was recorded.
coords.latitude number Degrees.
coords.longitude number Degrees.
coords.accuracy number Horizontal accuracy in meters. -1 if unknown.
coords.speed number Meters per second. -1 if unknown.
coords.heading number Degrees. -1 if unknown.
coords.altitude number | null Meters. null if unknown.
battery.level number 0–1. -1 if unknown.
battery.is_charging boolean
mock boolean true if the OS flagged the fix as simulated (Android mock location; iOS isSimulatedBySoftware).
extras object Only present when non-empty: http.extras merged with per-call extras (per-call keys win).

All numbers are JSON numbers, never strings.

event Recorded when
interval The normal clock: the effective interval has passed since the last recorded fix.
motionchange The device switched between moving and parked, including the first fix after start() and any changePace(). Always recorded immediately.
current getCurrentPosition({ persist: true }). Does not reset the interval clock.

A fix from the OS is recorded when its horizontal accuracy is within minAccuracyM (or minAccuracyM is 0) and at least interval − tolerance has passed since the last record (tolerance = min(0.5 s, 10 % of the interval)). In practice a 10 s interval records a fix every 10 s on both platforms. If more than interval + 30 s passes with only inaccurate fixes, the most accurate one seen is recorded anyway, and the log says so.

import type { Location } from 'react-native-long-ping';
interface Location {
uuid: string;
timestamp: string;
event: 'interval' | 'motionchange' | 'current';
is_moving: boolean;
coords: {
latitude: number;
longitude: number;
accuracy: number;
speed: number;
heading: number;
altitude: number | null;
};
battery: { level: number; is_charging: boolean };
mock: boolean;
extras?: Record<string, unknown>;
}

With http.locationTemplate, each record is rendered from a template instead. Tokens are replaced with raw JSON values; strings are inserted without quotes.

Token Value
{{uuid}} uuid (string)
{{timestamp}} timestamp (string)
{{event}} event (string)
{{is_moving}} is_moving
{{latitude}}, {{longitude}}, {{accuracy}}, {{speed}}, {{heading}}, {{altitude}} from coords
{{battery_level}}, {{battery_is_charging}} from battery
{{mock}} mock
{{extras}} extras as JSON object text ({} when empty)

An unknown token, or a template that doesn’t render valid JSON, makes configure() reject with INVALID_CONFIG.