Feb 4, 2025
0
Level 1
How to Get Real-Time Location of Vendors When App is Not Running in React Native?
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
1.1. How can I fetch a vendor’s real-time location when their app is closed (not in the foreground or background)?
1.2. 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.
Please or to participate in this conversation.