使用 React Native 的实时位置共享应用程序
Real Time location sharing application using react native
我想尝试制作一个与朋友共享位置的应用程序。
是否可以使用 React Native 地理定位 API 和 firebase?
如果不是,我可以采用什么其他方法?
您可以使用 ReactNative 的地理定位。
https://facebook.github.io/react-native/docs/geolocation.html#watchposition
检查 watchPosition
方法,它注册了一个回调,只要您的位置发生变化就会调用该回调,您将收到一个位置对象。
然后您应该将此数据发送到 firebase。
在您的所有设备上,您应该使用侦听器来侦听您的 firebase 云 Firestore 中的更改。
https://firebase.google.com/docs/firestore/query-data/listen
在您的应用程序上显示位置数据。
我想尝试制作一个与朋友共享位置的应用程序。
是否可以使用 React Native 地理定位 API 和 firebase?
如果不是,我可以采用什么其他方法?
您可以使用 ReactNative 的地理定位。
https://facebook.github.io/react-native/docs/geolocation.html#watchposition
检查 watchPosition
方法,它注册了一个回调,只要您的位置发生变化就会调用该回调,您将收到一个位置对象。
然后您应该将此数据发送到 firebase。
在您的所有设备上,您应该使用侦听器来侦听您的 firebase 云 Firestore 中的更改。
https://firebase.google.com/docs/firestore/query-data/listen
在您的应用程序上显示位置数据。