【问题标题】:Opening Google Map through Intent and adding marker in certain Latitude Longitude通过 Intent 打开谷歌地图并在某个纬度经度添加标记
【发布时间】:2016-06-08 00:49:46
【问题描述】:

我的应用通过 ACTION.VIEW 意图打开谷歌地图。当我只给出纬度和经度时,地图会显示没有标记的区域。为了获得标记,我使用了以下代码,

Uri uri = Uri.parse("geo:"+Double.parseDouble(dealer_lat)+","+Double.parseDouble(dealer_long)+"?q="+Uri.encode(dealer_nameX+", "+provider_location.toLowerCase()+","+provider_street.toLowerCase()));
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
intent.setPackage("com.google.android.apps.maps");
startActivity(intent);

但是这段代码确实通过我提供的地址搜索位置。 我需要将标记添加到 latLng 给出的位置,同时还显示带有某些文本的标记标签。 我该怎么办?

【问题讨论】:

标签: android google-maps google-maps-markers


【解决方案1】:
   String uri = "http://maps.google.com/maps?f=d&hl=en&saddr=" + geoPoint.getLatitude() + "," + geoPoint.getLongitude() + "&daddr=" +
                trip.getPickupLocation().getLatitude() + "," + trip.getPickupLocation().getLongitude();

        Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri));
        startActivity(Intent.createChooser(intent, "Select an application"));

【讨论】:

    猜你喜欢
    • 2013-08-16
    • 1970-01-01
    • 2013-04-17
    • 1970-01-01
    • 2020-07-18
    • 1970-01-01
    • 2014-10-04
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多