Frequency of Location Events Too Slow: 1 location recorded for a 5 minute / 1 mile drive
See original GitHub issueYour Environment
- Plugin version: 3.0.6
- Platform: Android
- OS version: 10
- Device manufacturer and model: Google Pixel 3
- Running in Simulator: No
- Cordova version (
cordova -v
): PhoneGap Build (Cordova cli 9.0) - Cordova platform version (
cordova platform ls
): PhoneGap build…? - Plugin configuration options: <variable name="GOOGLE_PLAY_SERVICES_VERSION" value="11.0.1" /> <variable name="ANDROID_SUPPORT_LIBRARY_VERSION" value="23+" /> <variable name="ALWAYS_USAGE_DESCRIPTION" value="App requires background tracking enabled" /> <variable name="MOTION_USAGE_DESCRIPTION" value="App requires motion detection" />
- Link to your project: https://walksafe.app (app store publish pending), you can find the apk on PhoneGap build at https://build.phonegap.com/apps/3486871/install/yAxPGgfqaUW6sxfVXW7b
Context
I have the plugin configured for 1000ms intervals, with ACTIVITY provider (activity interval is 2500). However, on a 1-mile drive (walk to car, drive, walk to my desk), I only received a single background location event. One event. I would think over a one mile drive (roughly 5 minutes), there should have been at least 2 or 3, ideally 10 or 20 events…yes? Am I wrong, my config wrong, or the code wrong? LoL!
Here’s my config:
BackgroundGeolocation.configure({
locationProvider: BackgroundGeolocation.ACTIVITY_PROVIDER,
desiredAccuracy: BackgroundGeolocation.HIGH_ACCURACY,
stationaryRadius: 10,
distanceFilter: 15,
notificationTitle: 'WalkSafe is keeping you safe',
notificationText: 'WalkSafe tracks your location and speed to see if you might be in danger and to log your location for your emergency contacts when sending an SOS message',
debug: false,
interval: 1000,
fastestInterval: 500,
activitiesInterval: 2500,
startOnBoot: true,
stopOnTerminate: false,
url: server.urlRoot + '/walksafe/store_gps_location',
httpHeaders: {
// We should have token by now because
// connectNativeLogger() only called by LOGIN_EVENT
'Authorization': server.token,
},
// customize post properties
postTemplate: {
lat: '@latitude',
lng: '@longitude',
accuracy: '@accuracy',
// Added to attempt server-side walk/run/drive detection
speed: '@speed',
altitude: '@altitude',
bearing: '@bearing',
// built above from deviceInfo()
sensor
}
});
Expected Behavior
I should have frequent background location events (more than 1 a minute)
Actual Behavior
Only a single background location posted over 5 minutes on a 1 mile drive
Possible Fix
Option to remove any time limitations or artificial restrictions on post frequency?
Steps to Reproduce
- Use config above
- Load into an app
- Go for a 1 mile drive
- Check server
- Look sadly at the screen and see only one or two event
Context
Trying to record location to keep users safe
Debug logs
No logs available. I can claw them out of the device if requested.
Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (6 by maintainers)
Top GitHub Comments
Dope. And you were right, adding
…did indeed fix it.
After a short time, the “long running” notification appeared and it kept running.
So, a big huge THANK YOU to your AWESOME support here haha!
Two followups:
I rebooted my phone, and updates to the server stopped until I restarted the app. Note
startOnBoot
IStrue
in my config … is that a bug or did I do something wrong in my config?Is there any way to get long running background updates without the long running notification? I seem to recall a “for-pay” plugin that seems to do that sans notification, but not sure if that’s still feasible or if the Android API requirements have changed…
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.