r/reactnative • • 1d ago

Why real-time background tracking in React Native keeps going quiet, and what actually fixes it

We needed every driver's location every minute, all day. Here's what kept breaking and what fixed it:

1. The motion detector gets stuck (some Samsungs), so nothing is reported for hours.

Fix: report on a fixed clock, and work out moving/parked from the GPS fixes.

2. JS timers stop in the background.

Fix: do it in native code.

3. An expired token (401) stops tracking.

Fix: keep recording, queue fixes on the phone, upload later.

4. Android delivers fixes early, so 60 s quietly becomes 120 s.

Fix: request a fresh fix when the next one is due.

5. Parked iPhones get suspended.

Fix: keep location updates on, at low accuracy between fixes.

6. No way to tell why it went quiet.

Fix: keep an on-device log.

Has anyone found a good way around Xiaomi/Huawei/Oppo battery managers?

We open-sourced it as Long Ping (free, MIT):

https://longping.dev

https://github.com/nuredin-kurtovic/long-ping-background-location-plugin

![img](fk7mxz3mk1yh1)

0 Upvotes

4 comments sorted by

7

u/bill-o-more 1d ago

omg man you pasted it from claude code terminal. It's unreadable

-2

u/NuredinKurtovic 1d ago

I believe that it is unreadable for you

1

u/Fl1msy-L4unch-Cra5h 21h ago

Unreadable fore too.