启动谷歌地图应用程序 [英] Launch Google Maps app
本文介绍了启动谷歌地图应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从我的应用程序推出谷歌地图。我使用的:
I'm trying to launch Google maps from my application. I'm using:
GeoPoint center = _mapView.getMapCenter();
Uri uri = Uri.parse("geo:"+center.getLatitudeE6()+","+center.getLongitudeE6());
Log.d(LOG_TAG, "Launching Google Maps with Uri: ("+uri+")");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
我和集中在某个地方在纽约市的地图进行了测试,但谷歌地图打开,不集中在那里。 我跟着Android开发者的网站参考使用:GEO:纬度,经度的格局。
I tested it with a map centered on somewhere in NYC, however Google maps opens not centered there. I followed Android Developer's site reference to use: "geo:latitude,longitude" pattern.
这是你看到打印日志:
Launching Google Maps with Uri: (geo:40763500,-73979305)
任何人都知道什么可以是问题?
anyone knows what can be the problem?
推荐答案
尝试使用:
Uri uri = Uri.parse("geo:"+(center.getLatitudeE6()/1E6)+","+(center.getLongitudeE6()/1E6));
借助 GEO:乌里格式采用十进制经/纬度而不是E6格式(度* 1E6)。
The geo: Uri format takes decimal latitude/longitude and not E6 format (degrees * 1E6).
这篇关于启动谷歌地图应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文