android-启动Google Maps应用

android-启动Google Maps应用,第1张

概述我正在尝试从我的应用程序启动Google地图.我正在使用:GeoPointcenter=_mapView.getMapCenter();Uriuri=Uri.parse("geo:"+center.getLatitudeE6()+","+center.getLongitudeE6());Log.d(LOG_TAG,"LaunchingGoogleMapswithUri:("+uri+")&quot

我正在尝试从我的应用程序启动Google地图.我正在使用:

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); 

我用纽约市某处中心的地图进行了测试,但是Google地图打开时未居中.
我遵循AndroID开发者网站的参考使用:“ geo:latitude,longitude”模式.

您看到的日志将打印:

Launching Google Maps with Uri: (geo:40763500,-73979305) 

有谁知道可能是什么问题?

解决方法:

尝试使用:

Uri uri = Uri.parse("geo:"+(center.getLatitudeE6()/1E6)+","+(center.getLongitudeE6()/1E6)); 

geo: Uri格式采用的是十进制纬度/经度,而不是E6格式(度* 1E6).

总结

以上是内存溢出为你收集整理的android-启动Google Maps应用全部内容,希望文章能够帮你解决android-启动Google Maps应用所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1092457.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-27
下一篇2022-05-27

发表评论

登录后才能评论

评论列表(0条)

    保存