在 firebase 中处理 react-native 地理位置更新

Handling react-native geolocation update in firebase

我有一个在后台跟踪用户的本机反应应用程序。我还有一个与 firebase 交互的 Nodejs 后端。 我想使用 react-native geolocation 更新 firebase 中的用户位置,但我担心每次位置更改时调用 API 都会调用太多。 我该如何处理这样的事情?

您可以使用 setInterval 在 5 秒或 10 秒后进行 api 调用,或者您可以计算用户从上次更新位置移动 5m 或 10m 后进行 api 调用的半径.