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.

Location not updating on server when app enters stationary when app is in background or is closed

See original GitHub issue

Hello @mauron85

Environment:

  • React Native version: 0.59.9
  • Plugin version: 0.6.3
  • Platform: Android
  • OS version: 7
  • Device manufacturer and model: Redmi Note 4
  • Plugin configuration options:
BackgroundGeolocation.configure({
      desiredAccuracy: 10,
      stationaryRadius: 10,
      distanceFilter: 5,
      notificationTitle: 'Background Tracking',
      notificationText: 'Enabled',
      debug: true,
      startOnBoot: true,
      stopOnTerminate: false,
      locationProvider: BackgroundGeolocation.DISTANCE_FILTER_PROVIDER,
      interval: 5000,
      url: url,
      syncUrl: url,
      httpHeaders: {
        ...this.props.headers
      },
      postTemplate: {
        lat: '@latitude',
        long: '@longitude',
        id: id` // you can also add your own properties`
      }
    })

Location updates correctly when app is in foreground or when sent to background while user is moving but if app goes into stationary region while app is closed or is background location stops to update. Even if I travel distance once app goes to stationary region from background or terminate state it does not exit stationary region and stops updating location on server.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:3
  • Comments:5

github_iconTop GitHub Comments

2reactions
bsor-devcommented, Jun 30, 2020

Did you try this?

0reactions
clarissacarchacommented, Feb 5, 2021

Hi, I’m getting the same problem. It seems like battery saver in android phones causing this. My phone is mi 10 lite and i followed this https://dontkillmyapp.com/xiaomi and now it is working fine. But how to prevent battery saver in react native to prevent this from happening?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Location not updating on server when app enters stationary ...
I'm having a problem with stationary, Location updates correctly when app is in foreground or when sent to background while user is moving ......
Read more >
Handling location updates in the background - Apple Developer
Configure your app to receive location updates when it isn't running in the foreground.
Read more >
@jromagosa/cordova-plugin-background-geolocation - npm
Plugin's background geolocation service actually becomes foreground service when app is in the background. Confusing, right? :D.
Read more >
Ionic Native - Background Geolocation
BackgroundGeolocation must be called within app.ts and or before Geolocation. Otherwise the platform will not ask you for background tracking permission.
Read more >
Config | Capacitor Background Geolocation - GitHub Pages
With distanceFilter: 0, Sets the desired interval for location updates, ... iOS from suspending your app in the background while in the stationary...
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