react-native-background-geolocation icon indicating copy to clipboard operation
react-native-background-geolocation copied to clipboard

Android: Location update frequency

Open honzahk opened this issue 9 years ago • 18 comments

Hello,

firstly, I want to thank you for implementing such a sophisticated and useful library, good job.

We consider buying license for Android, but could not get it to work as we need. I hope you can help us. Just to clarify, the purpose of application we develop is to track someone's positions while he is jogging or biking, so we can display the path he has traveled on the map. That means, the faster we get new locations, the better (regardless of the battery consumption, at least for now). The problem is, the refresh rate of location change event is always 10 or 11 seconds. Received locations' timestamp is always XX:YY:ZZ.000 (or .999,.001) , which is very deterministic, so i believe the frequency is being influenced by your module somehow. We also tried to use exactly the same config as your demo application uses, with no effect. It looks like config is ignored - is that because of missing license?

By the way, I am testing your module for 3rd day now, so I think I am aware of the module states etc. I always call .start() and then .changePace(true) to avoid stationary mode completely, dont need it.

Thanks in advance

Your Environment

  • Plugin version: 2.8.4
  • Platform: Android
  • OS version: 6.0.1
  • Device manufacturer / model: Samsung Galaxy A3 2016 (SM-A310F)
  • React Native version (react-native -v): 0.42.3

Expected Behavior

Location is updated according to config => distance-based update

Actual Behavior

IT SEEMS location updates are time-based, the weird behavior is described above

Steps to Reproduce

code is here

  1. press START (calls bgGeo.start())
  2. press MOVING (calls bgGeo.changePace(true))
  3. start walking outside, so you get some location updates

honzahk avatar Jul 28 '17 13:07 honzahk

Show me your config

christocracy avatar Jul 28 '17 13:07 christocracy

BackgroundGeolocation.configure({
    enabled: false,
    desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
    debug: true,
})

as simple as that..

honzahk avatar Jul 28 '17 13:07 honzahk

Read the docs for distanceFilter

christocracy avatar Jul 28 '17 13:07 christocracy

And use logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE while developing.

christocracy avatar Jul 28 '17 13:07 christocracy

BackgroundGeolocation.configure({
	enabled: false,
	desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
	debug: true,
	logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
	disableElasticity: true,
	distanceFilter: 1
})

This means new location will be given if its at least 1m different from the previous one, am I right? Received locations with these timestamps:

15:44:02.182
15:44:12:000
15:44:22:000
15:44:33:000
15:44:43:000
15:44:54:000

honzahk avatar Jul 28 '17 13:07 honzahk

I have no idea how you're testing or what platform you're talking about (iOS or Android).

christocracy avatar Jul 28 '17 13:07 christocracy

Are you observing the logs?

christocracy avatar Jul 28 '17 13:07 christocracy

The issue template is helpful. Please don't ignore it in the future.

Your Environment

  • Plugin version:
  • Platform: iOS or Android
  • OS version:
  • Device manufacturer / model:
  • React Native version (react-native -v):
  • Plugin config

Expected Behavior

Actual Behavior

Steps to Reproduce

1. 2. 3. 4.

Context

Debug logs

christocracy avatar Jul 28 '17 13:07 christocracy

I've just asked you 3 questions which are asked in the template:

  • Config
  • Platform
  • Logs.

christocracy avatar Jul 28 '17 13:07 christocracy

Sorry, could not find the template :/ You can check my code here, if it helps... I check the logs of course, but have no idea, what to search for.

honzahk avatar Jul 28 '17 13:07 honzahk

The template is there whenever you create a new issue. You deleted the text.

christocracy avatar Jul 28 '17 13:07 christocracy

How are you testing?

christocracy avatar Jul 28 '17 14:07 christocracy

What do you mean? I call .start(), then i call .changePace(true) via buttons and then i go outside to walk a bit with the PHYSICAL device, watching its screen :D

honzahk avatar Jul 28 '17 14:07 honzahk

Tested on another device right now, with exactly same result..

honzahk avatar Jul 28 '17 14:07 honzahk

set fastestLocationUpdateInterval: 0, distaneFilter: 0

christocracy avatar Jul 28 '17 14:07 christocracy

Wow Chris, thank you alot!!! I didnt notice fastestLocationUpdateInterval is set to 10000ms by default. It seems everything works right now. Consider changing it to 0ms by default. Its the FASTEST, not the ACTUAL one.

honzahk avatar Jul 28 '17 14:07 honzahk

Consider changing it to 0ms by default.

Bad idea. Read about here

christocracy avatar Jul 28 '17 14:07 christocracy

In your demo app, fastestLocationUpdateInterval is set to 10000ms also, but the location is updated much more often.

honzahk avatar Jul 28 '17 14:07 honzahk