capacitor-community / background-geolocation

A Capacitor plugin that sends you geolocation updates, even while the app is in the background.
MIT License
187 stars 57 forks source link

Background locations broken if distanceFilter enabled #87

Closed PawelPlutaUek20 closed 1 year ago

PawelPlutaUek20 commented 1 year ago

Describe the bug addWatcher does not send the location if the distanceFilter option value is greater than 0.

To Reproduce Steps to reproduce the behavior:

  1. Set distanceFilter to any value greater than 0
  2. The location is not sent in the background on android (it does in the foreground)

Expected behavior send the location if the distance difference is greater than the specified value in distanceFilter

Smartphone (please complete the following information):

Additional context

package.json:

{
    "@capacitor-community/background-geolocation": "^1.2.7",
    "@capacitor/android": "^4.6.2",
    "@capacitor/core": "^4.6.2",
    "@capacitor/ios": "^4.6.2",
}

additional capacitor plugins:

  plugins: {
    CapacitorHttp: {
      enabled: true,
    },
  },
jamesdiacono commented 1 year ago

I was not able to reproduce this problem with a distance filter of 10m, on my Samsung A52 running Android 12. Do you see the problem when you run the example app?

PawelPlutaUek20 commented 1 year ago

Thank you for the quick response, the error was actually caused by another plugin that I didn't have defined in the plugins (@capgo/capacitor-updater). I still didn't find the solution, but when I remove that plugin everything works fine. Great work btw!