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

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

问题描述

我正在开发一款 Android 应用,玩家可以根据自己的位置在手机上实时对战.在 Google 地图上,您可以通过一个小蓝点看到自己的位置、面向的方向以及移动的位置.我的问题是:如何在我的应用中集成类似的东西,以便当玩家移动时,您可以在 Google 地图片段上看到它?

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?

目前,每次您的位置更新时,我的应用程序都会放置一个新图钉.我正在寻找能够移动图钉而不是添加新图钉的东西.

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.

推荐答案

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

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 实时谷歌地图位置跟踪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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