capacitor-background-geolocation: Plugin doesn't send location updates when the screen goes off

Your Environment

  • Plugin version: 4.11.4
  • Platform: Android
  • Device OS version: 11
  • Device manufacturer / model: Realme X2
  • Android Studio version: Chipmunk | 2021.2.1 Patch 1
  • Capacitor info (npx cap doctor)
@capacitor/core: 4.6.1
@capacitor/android: 4.6.1
@capacitor/cli: 4.6.3
@capacitor/ios: 4.6.1
  • Plugin config provided to #ready:
{
  stopOnTerminate: false,
  foregroundService: true,
  url,
  headers,
  debug: true,
  xhrFields,
  httpRootProperty: '.',
  locationTemplate,
  distanceFilter: 30,
  elasticityMultiplier: 1.5,
  heartbeatInterval: 60,
  showsBackgroundLocationIndicator: true,
  notification: {
    title: 'Background Tracking Enabled',
    text: 'Your location is being sent to XBE.'
  },
  locationAuthorizationRequest: 'Always',
  backgroundPermissionRationale: {
    title: "Allow App to access to this device's location in the background?",
    message: "In order to track your activity in the background, please enable {backgroundPermissionOptionLabel} location permission\n",
    positiveAction: "Change to {backgroundPermissionOptionLabel}",
    negativeAction: "Cancel"
  }
}

Expected Behavior

Location updates should continue to be sent to our server even when the phone’s screen is off.

Actual Behavior

Location updates stop when the phone’s screen is turned off.

Steps to Reproduce

I turned on debug mode and am trying to figure out what’s happening based on the sound. https://transistorsoft.github.io/capacitor-background-geolocation/interfaces/config.html#debug Here’s what’s happening: In the list I can’t seem to find the first sound notification that is played when it begins. In the foreground, I get the notification sound location_sample and then location_recorded. After I put it in the background and turned off my screen, it would stay silent and when I turned back the screen on, it picked up again started with the initial notification sound, then the location_sample, then location_recorded. Tried it a few times, it did the same way every time.

Context

I was trying to check if location updates are being sent in the background.

Debug logs

Since the logs were too big to be pasted directly here on github, here’s a link to the logs: https://sharetext.me/9ovumqyann

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

But after he was back moving again, shouldn’t the phone Activity recognition

In a perfect world, yes. He should provide logs showing what the plugin was doing during that time after stopping.