I'm building a mobile app using React Native for the frontend and Laravel 11 for the backend APIs.
App Requirements:
- Customers can post jobs (e.g., air conditioner cleaning).
- Nearby vendors should receive push notifications even when their app is not running. Current Setup:
- I store vendors' latitude and longitude at signup.
Challenges I'm Facing:
- Getting Vendors' Real-Time Location When App is Not Running
- How can I fetch a vendor’s real-time location when their app is closed (not in the foreground or background)?
- Do I need to establish a persistent connection between the React Native app and Laravel, or is this not possible?
- Updating Location in Database
- If I can somehow retrieve the vendor’s location, how should I update their location in the database whenever they move?
What I’ve Tried:
- Researching background location tracking in React Native.
- Considering WebSockets or polling, but unsure if they work when the app is fully closed.
react-native-background-geolocation?