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

Motion Change takes too long to update #1996

Open Nabeel07925 opened 1 month ago

Nabeel07925 commented 1 month ago

Two issues/questions

  1. I have recently purchased the license for the React native sdk but it has some issues. The Motion type takes too long to update. For instance, if my motion changes from walking to driving (in_vehicle), it takes almost 5 minutes to update the motion state, absolutely not suitable for my use case. I am using the sdk for a car parking system I am developing and I need to capture the change in motion within a couple seconds at most.
  2. Sometimes the app doesn't capture motion at all in the background, I don't get any http request on my server when I start walking or even driving. I have to trigger the app again and again (open and close) to make it work, which sometimes work and sometimes doesn't.

Your Environment

System:

Expected Behavior

I should immediately get both motion and location updates without any delay as soon as I start moving with correct motion type.

Actual Behavior

Sometimes, motion updates don't work in the background. It starts working after 10, 20 minutes all of a sudden. I don't have any geofencing enabled as of now. Also motion update is not correct most of the times. It gives walking when I am in a vehicle and sometimes gives in_vehicle state when I am idle or walking.

Steps to Reproduce

Just run the app with these configurations, terminate the app and check the updates in db or server. I am not sure if the issue I am facing is because of some misconfiguration or it's an actual bug.

Context

I am trying to develop a car parking application where the mobile of the user is used a tracker. I rely heavily on the motion and location updates from this library. When the motion type changes from in_vehicle to walking, I check a couple of events on my side and update the parking location of the car. Without motion update within seconds, the app doens't work correctly.

Debug logs

Don't have logs

PASTE_YOUR_LOGS_HERE

christocracy commented 1 month ago
  1. There’s nothing that can be done about that.
  2. See https://dontkillmyapp.com
christocracy commented 1 month ago

You’ll have better/worse performance on different devices.

my Pixel 6 performs beautifully.

Nabeel07925 commented 1 month ago

I see. Secondly, about the motion type not working properly, is it something wrong with my configuration or a bug in the library?

christocracy commented 1 month ago

is it something wrong with my configuration or a bug in the library?

No. The Motion api is provide by Google Play Services. It’s proprietary code created by Google. This api provides nothing more than an ON/OFF switch. It is not configurable.

Nabeel07925 commented 1 month ago

Thanks for the quick response @christocracy. I see an option activityRecognitionInterval in the docs which is deprecated, that's why I asked. Actually I worked with the google activity recognition api earlier and it was pretty accurate but the downside was I wasn't able to configure it to work in the background (when app terminates) so I shifted to this library. Is there anything we can do to improve the results?

christocracy commented 1 month ago

activityRecognitionInterval

That option is no longer used. It comes from the old Android ActivityRecognitionApi. This plug-in transitioned to the more modern ActivityTransitionApi years ago.

Is there anything we can do to improve the results?

I already answered this question: no. The api is either ON or OFF. Everything else depends upon Google’s proprietary code, the quality of the sensors on your device and the manufacturer’s version of the Android OS running on your device.

there is no configuration for the plug-in that affects the performance of the motion api.

Nabeel07925 commented 1 month ago

Got it. thanks for confirming.

github-actions[bot] commented 1 day ago

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