transistorsoft / react-native-background-geolocation

Sophisticated, battery-conscious background-geolocation with motion-detection
http://shop.transistorsoft.com/pages/react-native-background-geolocation
MIT License
2.54k stars 424 forks source link

[Question] - Apple workarounds for background throttling #1966

Closed joshuadunning closed 2 weeks ago

joshuadunning commented 2 months ago

The software is working great for our users, but it seems that app kills will randomly throttle locations. I know this is expected behavior and was hoping someone might have success with working around this. As I understand it, the more the user opens the app, the more likely Apple will allow you to continue tracking.

Other than the obvious of forcing the user to open the app more frequently, has anyone had success with things like data only push notifications or something similar? I've seen some competitors (That are MUCH higher priced) claim they can reliably keep tracking going, but I'm not sure how they would accomplish it.

The app I have is operating similarly to a Life360, and my users are really expecting it to feel as accurate as that. Any experienced advice would be super helpful to get around these limitation!

christocracy commented 2 months ago

Apple does not kill apps when location-services are activated and the plug-in tracking.

christocracy commented 2 months ago

I've seen some competitors (That are MUCH higher priced)

Like who?

joshuadunning commented 2 months ago

So we have dozens of reports where people have been driving and they freeze on the road. Battery is good, and their phone stays on and in cell service. My best guess is that they kill our app, causing it to need to relaunch in background, but Apple says no. That's why I was spitballing the data only notifications.

And the competitor is radar.com

christocracy commented 2 months ago

If the user kills their app, it's going be re-launched after ~200 meters of movement and the plug-in will resume tracking. This is easily demonstrated in the iOS simulator with "Freeway Drive". Kill your app with the plug-in configured with debug: true. You will see it never fail to be resurrected and resume tracking. There's nothing you can do to stop it from doing so.

Are you checking your XCode logs and/or Crashalytics for crashes (from your own code)?

Radar Labs.

Theirs is a completely different business model where you share all your data with them and pay for every event.

There's little Radar does that mine cannot.

joshuadunning commented 2 months ago

Got it, I've always had a perfect experience while testing on my devices with it coming back alive. I'll see about adding some better metrics and logging to help debug this more deeply for my users. They are expecting accuracy to be similar to Life 360 which I think is employing some additional BT tech or something under the hood. Hoping to find a way to improve even further without doing battery killing things like prevent suspend, disable stop detection etc...

christocracy commented 2 months ago

Life 360 which I think is employing some additional BT tech or something under the hood

There's nothing that BT can do to improve tracking quality or accuracy.

joshuadunning commented 2 months ago

The behavior I observed was with two phones linked in Life 360. While driving, both are moving together of course. Then I took one and disabled wifi and cellular data, locations still updated actually for that phone. Only after going completely in airplane mode did the locations get disabled. It seems that there is some BT chatter happening to keep that phone on the map even when data networks are shut off.

christocracy commented 2 months ago

disabled wifi and cellular data, locations still updated actually for that phone

Cell data has no effect on tracking. I test all my Android phones without a SIM card. They work fine and promptly sync records once they sense my home wifi.

Wifi is not required when GPS is present (ie when a device is outside).

joshuadunning commented 2 months ago

Ah gotcha so I guess those could be queued to be sent to the server once a connection is available again. The weird thing from our testing was that turning off all outgoing internet connections from the phone still tracked it's location perfectly on the other phone monitoring. Not sure how that location would be updated on life 360's servers.... Either way I appreciate the feedback and hope to find come up with some good ways to troubleshoot why some of our user locations are dropping. Fantastic product and service sir!

christocracy commented 2 months ago

You can listen to .onProviderChange to learn if they disable location-services.

joshuadunning commented 2 months ago

You can listen to .onProviderChange to learn if they disable location-services.

Yup we actually already have that on and notify relevant users when turned off!

github-actions[bot] commented 4 weeks ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 2 weeks ago

This issue was closed because it has been inactive for 14 days since being marked as stale.