Oyekeye Sam
Oyekeye Sam

Reputation: 83

Handling react-native geolocation update in firebase

I have a react-native application that tracks the user in the background. I also have a Nodejs backend that interacts with firebase. I want to update user location in firebase using react-native geolocation but I'm worried that calling the API every time position changes will be too many calls. How do I handle something like this?

Upvotes: 0

Views: 232

Answers (2)

Shaun Lewis
Shaun Lewis

Reputation: 1

Try using RTDB(Real Time Database) since Google charges you for capacity instead of read/writes. This is how I update my GeoLocation in my apps for Firebase.

Upvotes: 0

Ali Hayder
Ali Hayder

Reputation: 325

You can either use setInterval to make api call after 5 or 10 seconds or you can calculate the radius that if the user moves 5m or 10m from last updated location then make an api call.

Upvotes: 1

Related Questions