HaylLtd/cordova-background-geolocation-plugin

On Background and Stationary, the plugin ignores the interval and send data every millisecond.

Closed this issue · 2 comments

Describe the bug
On Background and Stationary state, the plugin ignores the interval and send data every millisecond.

To Reproduce
Steps to reproduce the behavior:

  1. Use the below configuration.
  2. Open the app, and send in background or stationary state.
  3. Add breakpoint on server side and observe the number of http post requests receiving at the endpoint.

Expected behavior
A clear and concise description of what you expected to happen.

Configuration
BackgroundGeolocation.configure({
locationProvider: BackgroundGeolocation.DISTANCE_FILTER_PROVIDER,
desiredAccuracy: BackgroundGeolocation.HIGH_ACCURACY,
stopOnTerminate:false,
stationaryRadius: 50,
distanceFilter: 50,
notificationTitle: 'Background Tracking',
notificationText: 'Verifying your current location',
debug: false,
interval: 60000,
fastestInterval: 120000,
activitiesInterval: 120000,
url:'http://server',
postTemplate: {
Latitude: '@latitude',
Longitude: '@longitude',
Provider: '@Provider',
Accuracy: '@accuracy'
}
});

Smartphone (please complete the following information):

  • Device: Xiaomi
  • OS: Android@12
  • Version [22]

Additional context
I'm configuring the plugin to send location updates (data) every five minutes, in every state (FG, BG, Stationary, Terminate). For that purpose I'm using the above configuration. I expect the plugin to send data every five minutes, in every state. But it sending data after every milli seconds in Background + Stationary state. But on termination, it stops sending data in that frequency.

Update:
On removing the below line of codes, the plugin is neither sending requests every milli second nor after the set interval:

//Stationary-state check:
BackgroundGeolocation.on('stationary', function(stationaryLocation) {
console.log('[info] App is in stationary state')
BackgroundGeolocation.configure({ debug: true });
});
So the confusion here is; Does it configure other params as default, when we use subset/subsets of the whole configuration?

HarelM commented

I suggest reading the plugin's logs and debugging if needed.
The GPS configuration is complicated and what you get back from the device is not straight forward in most cases...