React-native-background-geolocation: Not working on background mode

Created on 24 Dec 2018  路  9Comments  路  Source: mauron85/react-native-background-geolocation


Your Environment


  • Plugin version: ^0.5.0-alpha.50
  • Platform: iOS or Android
  • OS version:
  • Device manufacturer and model:
  • Running in Simulator:
  • React Native version:
  • Plugin configuration options:
  • Link to your project:

Context

Expected Behavior

Actual Behavior

Possible Fix

Steps to Reproduce



1.
2.
3.
4.

Context

Debug logs

stale

Most helpful comment

I have also tested it on Android 8.0 and above. It seems that the high-level RN code components (the listeners such as BackgroundGeolocation.on('location',()=>{}) ) and the low-level Android/IOS native code components (e.g., the debug toast) behaves separately.

The behaviour is that:

  1. upon switching out (pressing HOME button or switching to another APP), both continue to function.
  2. upon close (the square button followed by CLOSE or CLEAR ALL), the RN code components will stop running while the native code components continue to run.

FYI, I have taken all precautions:

  1. in configure(), stopOnTerminate must be set to false; stopOnStillActivity must be set to false
  2. in componentWillUnmount(), BackgroundGeolocation.removeAllListeners() must be commented out

To me, this plugin is merely a native implementation of the background geolocation, plus some linkage to RN. Unfortunately, only the native code components can run after APP close, the RN code components do not run after APP close. Thus, it is not of much usefulness.

All 9 comments

I use this plugin into react-native project. its working fine when application run or open into the background. But if application close from task manager plugin not work. this issue occurs on android above 8.0.

I have also tested it on Android 8.0 and above. It seems that the high-level RN code components (the listeners such as BackgroundGeolocation.on('location',()=>{}) ) and the low-level Android/IOS native code components (e.g., the debug toast) behaves separately.

The behaviour is that:

  1. upon switching out (pressing HOME button or switching to another APP), both continue to function.
  2. upon close (the square button followed by CLOSE or CLEAR ALL), the RN code components will stop running while the native code components continue to run.

FYI, I have taken all precautions:

  1. in configure(), stopOnTerminate must be set to false; stopOnStillActivity must be set to false
  2. in componentWillUnmount(), BackgroundGeolocation.removeAllListeners() must be commented out

To me, this plugin is merely a native implementation of the background geolocation, plus some linkage to RN. Unfortunately, only the native code components can run after APP close, the RN code components do not run after APP close. Thus, it is not of much usefulness.

Since the name itself says 'BackgroundGeolocation' which contains 'GeoLocation' so I'm wondering if it requires GPS or Location Permission for functioning of this module?

+1 @xuancong84 any work around?

A work around for this would be to save the tracking status in redux persist, then you can fetch the status of the tracking when the app opens again.

So apparently there is no way for this to work if app is killed !

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.

This issue has been automatically closed, because it has not had recent activity. If you believe this issue shouldn't be closed, please reopen or write down a comment requesting issue reopening with explanation why you think it's important. Thank you for your contributions.

anything update?

Was this page helpful?
0 / 5 - 0 ratings