React native expo background location send to firebase

Hi, I have develop the application in the react native. Now this application is related to truck drivers. So we have added load and when they accept the load then we fetch the location to firebase. Now issue is its not working when app close (background) on physical device. We tried on simulator and its working perfectly in the background. But when i make the build and test on physical device its not working for background task.

We can't help with React code, and you have not explained what it is you are trying to do other than "its not working", but seeing it works in the simulator and not on a real device sounds like https://forums.developer.apple.com/forums/thread/685525 will be a good starting point to understand why it may not be working on a real device.

I have developed an app designed to fetch real-time location updates and send them to Firebase. The app functions as follows. When the user clicks a button, the background location tracking starts, and the app begins sending location updates to Firebase every 10 seconds. While the app is running in the foreground, or even in the background (still present in recent apps), the location updates work as expected.

However, the issue arises when the user swipes up to remove the app from the recent apps or multitasking screen. After this, the app stops sending background location updates to Firebase.

To address this, I have already configured the necessary permissions in the Info.plist:

NSLocationAlwaysUsageDescription
NSLocationWhenInUseUsageDescription
NSUserTrackingUsageDescription
NSLocationAlwaysAndWhenInUseUsageDescription

The purpose of this app is to track drivers' real-time locations. If a driver moves to a new location, I need to receive their location updates continuously until they manually stop the tracking by clicking the stop button in the app. However, if they remove the app from the background (swipe up), the location tracking stops, which interrupts the functionality of the app.

I understand that iOS imposes strict limits on background execution, particularly after a user force-quits the app, but I would like to know if there are any recommended solutions or best practices that align with these limitations to ensure real-time location tracking can continue.

Thank you for your guidance.

React native expo background location send to firebase
 
 
Q