使用React Native的实时位置共享应用程序 [英] Real Time location sharing application using react native

查看:129
本文介绍了使用React Native的实时位置共享应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想尝试与我的朋友分享位置信息的应用程序.

I want to try making an application for location sharing with my friends.

是否可以使用react native geolocation API和firebase?

Is it possible using react native geolocation API and firebase?

如果不能,我可以采用其他什么方法?

If not what other approach can i follow?

推荐答案

您可以使用ReactNative的地理位置.

You can use Geolocation of ReactNative.

https://facebook.github.io/react-native /docs/geolocation.html#watchposition

检查watchPosition方法,它注册一个回调,该回调在您的位置更改时调用,并且您将收到一个位置对象.

Check the watchPosition method, it registers a callback which invokes whenever your location changes, and you will receive a position object.

然后您应该将此数据发送到firebase.

You should then send this data to firebase.

在所有设备上,您应该使用侦听器侦听Firebase云Firestore中的更改.

On all your devices, you should use a listener to listen for changes in your firebase cloud firestore.

https://firebase.google.com/docs/firestore/query -数据/收听

在您的应用上显示位置数据.

Display the location data on your app.

这篇关于使用React Native的实时位置共享应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆