打开地图应用程序显示拉特隆附近的网站?

时间:2015-04-09 20:59:47

标签: android google-maps-android-api-2

是否可以打开显示某个位置附近网站的Google地图(Android应用或网站)?

我要求打开googlemaps应用以显示某个位置附近的网站,而不是从Google获取网站的请求,这会强制我的应用自行处理并显示。

由于

2 个答案:

答案 0 :(得分:0)

是的,这是可能的,这是

的后端api
StringBuilder sb = new StringBuilder(
                                "https://maps.googleapis.com/maps/api/place/nearbysearch/json?");
                        sb.append("location=" + mLatitude + "," + mLongitude);
                        sb.append("&radius=5000");
                        sb.append("&types=" + type);
                        sb.append("&sensor=true");
                        sb.append("YOUR API KEY");

答案 1 :(得分:0)

@Hulk你是部分正确的。你打电话是必要的,以显示他需要的位置附近的针脚。此代码转到onMapReady(GoogleMap map)函数

    LatLng myLatLong = new LatLng(mLatitude, mLongitude);

    map.setMyLocationEnabled(true);
    // To make you map show the location you need, use moveCamera
    // 13 is the zoom level on the maps
    map.moveCamera(CameraUpdateFactory.newLatLngZoom(myLatLong, 13));

    //List of all the nearby places from the previous call
    List<Place> nearbyPlaces = getNearbyPlaces(); 

    //Iterate through the nearbyPlaces to add them to the map
    for (Place placeToShow : nearbyPlaces)
         map.addMarker(new MarkerOptions()
            .title(place.getName())
            .snippet(place.getDescription())
            .position(place.getLatLng()));

getNearbyPlaces也是@Hulk提供的电话

StringBuilder sb = new StringBuilder(
                                "https://maps.googleapis.com/maps/api/place/nearbysearch/json?");
                        sb.append("location=" + mLatitude + "," + mLongitude);
                        sb.append("&radius=5000");
                        sb.append("&types=" + type);
                        sb.append("&sensor=true");
                        sb.append("YOUR API KEY");

并且响应可以转换为放置对象。

放置模型a.k.a Place.java

Public class Place {
     private String name;
     private String description;
     private LatLng latLng;
 //Also write getters and setters
}

请参阅https://developers.google.com/maps/documentation/android/