Android实时Google地图位置跟踪 [英] Android real-time Google Maps location tracking

查看:245
本文介绍了Android实时Google地图位置跟踪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一款Android应用,玩家可以根据自己的位置实时在手机上进行实时对战。在谷歌地图上,您可以看到自己的位置,朝向哪个方向以及移动的位置,全部来自一个小蓝点。我的问题是:如何在应用中整合类似内容,所以当玩家移动时,您可以在Google地图片段中看到它?



编辑:目前,每当您的位置更新时,我的应用程序都会丢弃一个新针。我正在寻找一些 移动 引脚,而不是添加新的引脚。

解决方案

我找到了一个临时解决方案!我现在正在调用 map.clear(),然后向需要的地方添加新的标记......我决定这是最好的,因为我正在动态创建新的,而不仅仅是一个数组或单个标记。

I am working on an Android app where players battle each on their phones in real-time based on their location. On Google maps, you can see where you are, in what direction you are facing, and where you are moving, all from a little blue dot. My question is: How can I integrate something like that in my app, so when the player moves, you can see it on the Google Maps fragment?

Edit: Currently, my application drops a new pin every time your location updates. I'm looking for something that moves the pin rather then adding a new one.

解决方案

I found a temporary solution! What I'm doing now is calling map.clear(), and then adding new markers to the places I need... I decided this was best because I am dynamically creating new ones, and not just working with an array, or single marker.

这篇关于Android实时Google地图位置跟踪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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