1

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:

  1. 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?
  1. 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.
2
  • Did you try with react-native-background-geolocation ? Commented Feb 5 at 6:46
  • @nazmul Does it work even when the app is not running or has been killed? Commented Feb 5 at 17:55

2 Answers 2

0

IOS only accept tracking location when foreground and background we can't do anything when app kill. Android, we can use service foreground when kill app. You can find so many example for this

Sign up to request clarification or add additional context in comments.

Comments

-1

I also tried for this type of functionality but in react native i can not find any solution , You want to use native code for this functionality. Create foreground services in android java code and then use in react native for start them and store in java code write code for that service like if vendor move on some distention then it call api or on every specific time it call like every 10 min

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.