Rapsssito / react-native-background-actions

React Native background service library for running background tasks forever in Android & iOS.
MIT License
818 stars 117 forks source link

Background Location Tracking Stops Working After Some Time When App is Killed or in Background. #233

Closed meetanshisatpute closed 4 months ago

meetanshisatpute commented 4 months ago

Issue Description I am facing an issue with the react-native-background-actions library in my React Native project. My application is a delivery partner app, and it is crucial for us to fetch the delivery partner's location even when the app is in a killed state. However, this library stops working after some time on all Android devices when the app is killed or in the background.

Permissions in AndroidManifest.xml: `

` Question Are these permissions sufficient for the location task to work correctly? Do I need to add any additional permissions to ensure continuous location tracking?

Steps to Reproduce Install the react-native-background-actions library in a React Native project. Implement location tracking as described in the documentation. Run the app on any Android device. Kill the app. Observe that the location tracking stops after some time.

Expected Behavior The location tracking should continue even when the app is killed or in the background, ensuring continuous location updates for the delivery partner.

Actual Behavior The location tracking stops after some time when the app is killed or in the background on all Android devices.

Environment React Native version: 0.73.6 Library version: 4.0.1 Android versions tested: Multiple versions (10, 11, 14) Devices tested: Vivo V23e, Samsung Galaxy J6, Redmi 8, OnePlus.

please let me know if any further information is required.

Rapsssito commented 4 months ago

This is common, as the OS has absolute control over the background processes of the device. See https://github.com/Rapsssito/react-native-background-actions/issues/22#issuecomment-628737527