react-native-background-geolocation: Background geofencing not working after app is closed or phone is restarted! Even after configuring it corretly.

Your Environment

  • Plugin version: ^4.0.3
  • Platform: iOS or Android : Android
  • OS version: 9 (onwards)
  • Device manufacturer / model: Nexus
  • React Native version (react-native -v): 0.64.0
  • Plugin config
BackgroundGeolocation.ready(
    {
      desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
      distanceFilter: 10,
      reset: true,
      stopTimeout: 1,
      debug: false, // <-- enable this hear sounds for background-geolocation life-cycle.
      persistMode: BackgroundGeolocation.PERSIST_MODE_ALL,
      logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
}

Expected Behavior

Even after configuring it correctly it is not working in background. it stops working I need to it to work even after user closes the app or user restart the app

Actual Behavior

It stops working soon as user close the app or switch to another app.

Steps to Reproduce

  1. Start the app.
  2. Start Geofencing using any event
  3. Close the app
  4. the app will stop detecting position and triggering event based on provided geofences

Context

I am trying to create emergency app which will trigger event based on provided geofences it must work in the background to fulfill its purpose.

About this issue

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

Most upvoted comments

BackgroundGeolocation.onHttp(

Why are you implementing an onHttp listener if you’re not even proving the plug-in a Config.url?

the plug-in has a built-in, native HTTP service that works quite well. See api docs Config.url.