gpt4 book ai didi

android - 启动谷歌地图应用

转载 作者:太空宇宙 更新时间:2023-11-03 13:07:02 27 4
gpt4 key购买 nike

我正在尝试从我的应用程序启动 Google map 。我正在使用:

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

我用一张以纽约某处为中心的 map 对其进行了测试,但 Google map 打开时并未以该处为中心。我按照 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 - 启动谷歌地图应用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2553251/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com