techhunt22's avatar

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:

  1. Customers can post jobs (e.g., air conditioner cleaning).
  2. 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:

  1. 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

  1. 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:

  1. Researching background location tracking in React Native.
  2. Considering WebSockets or polling, but unsure if they work when the app is fully closed.
0 likes
0 replies

Please or to participate in this conversation.