Skip to content
Support the creatorSupport

Choosing intervals & battery

Long Ping records on a clock. You choose two intervals, and the device decides which one applies from its own fixes:

  • movingIntervalSec (default 30 s) while moving,
  • parkedIntervalSec (default 180 s) while parked.

Anything from 1 second to 24 hours works. Moving or parked is decided from speed and distance (see Stop detection); motion changes are always recorded immediately, whatever the interval.

30 s

movingIntervalSec · 1 s and up

3 min

parkedIntervalSec · default 180 s

8 h
3 h

Driving + parked ≤ 24 h. The rest of the day tracking is off.

1 min

http.uploadIntervalSec · 0 = upload as soon as a fix is recorded

Assumes batching on (maxBatchSize 100), about 360 bytes per default record and about 1 KB of HTTP headers per request. Motion-change fixes, TLS and your own extras are not counted.

Fixes per day

1,020

Upload requests per day

540

Data per day

≈ 907 KB

Battery

Estimate · pending device measurements
While moving3–6 %/h
While parked1–2 %/h
Over the tracked day27–54 %

Anchor points: moving every 5 s ≈ 5–10 %/h, every 30 s ≈ 3–6 %/h, every 60 s or longer ≈ 1.5–3 %/h (iOS drops to low power between fixes from 60 s); parked every 3 min ≈ 1–2 %/h. Values between anchors are interpolated. Real numbers depend on the phone, signal, screen and the rest of your app.

Your config

await LongPing.configure({
  movingIntervalSec: 30,
  parkedIntervalSec: 180,
  http: {
    url: 'https://api.example.com/locations',
    uploadIntervalSec: 60,
  },
});
Use Moving Parked Upload Notes
Live dispatch, customer ETAs 5–10 s 60–180 s 10–15 s Plan for in-vehicle charging.
Fleet tracking (the defaults) 30 s 180 s 60 s A good first rollout.
Proof of visit, timesheets 60–120 s 300–600 s 300 s iOS uses its low-power mode between fixes.

You do not have to get this right up front. Intervals can be changed at runtime with setConfig(), or for a whole fleet from your server with remote config, without an app release.

The moving interval, by far. Below about a minute the GPS is effectively on all the time. From 60 s up, iOS drops to a low-power mode between fixes and switches to full accuracy 15 s before the next fix is due. See How iOS background tracking works.

Accuracy. accuracy: 'high' (the default) asks for the best fix the OS can give. 'balanced' and 'low' cost less and are much less precise; for vehicles on roads, 'high' is usually worth it.

Uploads. uploadIntervalSec: 0 (the default) sends a request as soon as each fix is recorded. With a 30 s moving interval that is two requests a minute; with uploadIntervalSec: 60 and batching it is one. Fewer, larger requests are cheaper on radio time and on your server.

Things you can’t see from here: screen time, navigation apps running alongside, weak signal (the radio works harder), cold weather. Treat any estimate as a range.

await LongPing.configure({
movingIntervalSec: 10,
lowBattery: { belowPct: 20, intervalSec: 60 },
});

When the phone is not charging and the battery is below belowPct percent, the effective interval becomes at least intervalSec, for both moving and parked. It switches back as soon as the phone charges or the level rises. Both fields are required.

The parked interval only helps if the device notices it has stopped. The defaults suit vans and cars:

Key Default Raise it when Lower it when
stopTimeoutSec 300 Stops are short and you want them to count as moving (traffic, loading bays). You want the parked clock sooner after arriving.
stopRadiusM 75 GPS drifts a lot where you park (urban canyons, garages). You need to tell apart stops that are close together.
movingSpeedMps 3 Walking around the vehicle keeps flipping it to moving. Slow vehicles (bikes, carts) never count as moving.

disableStopDetection: true keeps the device on the moving clock the whole time.

The cheapest fix is the one you never take. Call start() when a driver goes on duty and stop() when they go off duty. stop() keeps the queue and keeps uploading it until it is empty.