Isaac Wasserman
Isaac Wasserman

Reputation: 1541

React Native Location Services “nearby” Implementation

I’m building a React-Native social media app with a feature that allows you to find other users who are nearby. I know React Native has location services capabilities, but I’m not sure how I would implement this type of background location tracking. Anyone know?

Upvotes: 1

Views: 275

Answers (2)

hong developer
hong developer

Reputation: 13926

You can solve the problem through the library officially supported by React-native.

react-native-background-geolocation

Links you can refer to for troubleshooting

Upvotes: 0

Dinesh Verma
Dinesh Verma

Reputation: 666

I hope you have built something like this by now, but still, I will try to help you out here.

  1. Get user's current location and store it in ES/MongoDB. You will do this for all other users as well. So, now you have a data source containing all users' current locations.

  2. Now do a query to ES/MongoDB to get users with their current locations in X miles radius of your current user's location.

Voila you have this feature ready.

PS: To get user's current location you can use the react-native-location package.

Upvotes: 1

Related Questions