谷歌地图绘制路由更新运动 [英] Google maps draw route with updating movement
问题描述
刚刚完成我的应用程序,它显示了一个MapView的两个给定位置之间的路线。没什么特别,我刚开始与谷歌地图。经过一番思考,我碰到,这将是很好,如果它被重新绘制在运动像一个真正的GPS服务。
Just finished my application that shows a route between two given positions with a MapView. Nothing fancy, I've just started with google maps. After some thoughts I came across that it would be nice if it was redrawn on movement like a real GPS-service.
所以,我的问题是:
-
有多难,以实现自己一个GPS?我明白,我可以在一段时间连续fecthing KML文件每一次做一个吧。但如何有效真的是这样考虑batteryusage和CPU?谷歌地图可以让你请求2500times /天,做所有这些更新计为一个?
How hard is it to implement a GPS on your own? I understand that I can make one now by continuously fecthing a kml file every once in a while. But how efficient is this really considering batteryusage and CPU? Google maps lets you request 2500times/day, does each of these updates counts as one?
可以开始给出的开始和结束位置的谷歌地图应用程序?这可能是我的一个简单的解决方案,然后..
Can you start the Google maps application with given start and end position? This might be a simpler solution for me then..
推荐答案
Whay你不打开谷歌地图,意图给你的出发点和归宿点。
Whay don't you open google maps with intent giving your starting point and end point.
Intent navigation = new Intent(Intent.ACTION_VIEW, Uri
.parse("http://maps.google.com/maps?saddr="
+ Constants.latitude + ","
+ Constants.longitude + "&daddr="
+ latitude + "," + longitude));
startActivity(navigation);
这将打开任何地图应用程序。是指一个浏览器或谷歌地图应用程序。如果你只是想谷歌地图和摆脱对话框,你可以给意向的提示,你想用哪个包。
This opens any maps application. Means a browser or google maps application. If you just want google maps and get rid of the dialog you can give the intent a hint as to which package you want to use.
在该 startActivity()
补充一点:
intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");
这篇关于谷歌地图绘制路由更新运动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!