question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Frequency of Location Events Too Slow: 1 location recorded for a 5 minute / 1 mile drive

See original GitHub issue

Your 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

  1. Use config above
  2. Load into an app
  3. Go for a 1 mile drive
  4. Check server
  5. 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:closed
  • Created 4 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
josiahbryancommented, Sep 17, 2019

Dope. And you were right, adding

 <edit-config file="AndroidManifest.xml" mode="merge" target="/manifest/uses-permission" xmlns:android="http://schemas.android.com/apk/res/android">
          <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
        </edit-config>

…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 IS true 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…

0reactions
stale[bot]commented, Mar 16, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Frequency of Location Events Too Slow: 1 location recorded for a 5 ...
I have the plugin configured for 1000ms intervals, with ACTIVITY provider (activity interval is 2500). However, on a 1-mile drive (walk to car,...
Read more >
The Speed of Sound - The Physics Classroom
The speed of a sound wave refers to how fast a sound wave is passed from particle ... the distance-per-time ratio or as...
Read more >
Physical Agility Test Prep - Kentucky Law Enforcement Council
Five (5) physical agility tests will be given in three (3) hours, ... Resting within the 1 minute time limit is allowed in...
Read more >
Earthquake Facts & Earthquake Fantasy - USGS.gov
FACT: Earthquakes are sudden rolling or shaking events caused by movement under the Earth's surface. An earthquake is the ground shaking caused by...
Read more >
NOAA Weather Radio Frequently Asked Questions
What is the difference between a “mile per hour (MPH)” and a “knot”? ... All NOAA Weather Radio stations broadcast on one of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found