我正在尝试从我的应用程序启动 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)。
我是一名优秀的程序员,十分优秀!