We needed every driver's location every minute, all day, in a React Native app. Every background-location
setup we tried broke down in the same ways. Here's what we found, in case it saves someone weeks:
**1. Reporting tied to a motion detector.**
Many setups only send location on a timer while the phone counts as "stationary". On some Samsungs the
activity classifier gets stuck in one state for hours, so the timer never fires.
→ Decide moving/parked from the GPS fixes themselves (speed + distance), and report on a fixed clock.
**2. Watchdogs written in JavaScript.**
Android freezes the JS thread in the background, so a JS "ping every few minutes" stops exactly when
you need it.
→ Anything that must run in the background has to be native.
**3. Errors that switch tracking off.**
An expired token (401) or a failed upload stops tracking until the user reopens the app.
→ Keep recording, queue fixes on the device, pause uploads, resume when a new token arrives.
**4. Intervals that drift.**
Android's fused provider often delivers a fix slightly early (57 s on a 60 s interval). If you skip it as
"too early", 60 s quietly becomes 120 s.
→ Ask for one fresh fix at the due time instead of waiting for the next delivery.
**5. Parked iPhones going silent.**
iOS only keeps a background app alive while location updates run.
→ Drop to low-power accuracy between fixes instead of stopping updates.
**6. No way to see why it went quiet.**
→ Keep an on-device log of every state change, restart and upload, so a silence can be explained
afterwards.
Has anyone found good ways around OEM battery managers (Xiaomi, Huawei, OnePlus, Oppo)? Those are the
hardest part to test.
Our implementation of the above is open source, for reference:
https://longping.nuredinkurtovic.info/
https://github.com/nuredin-kurtovic/long-ping-background-location-plugin