Android 安卓谷歌地图寻找最近的地方

Android 安卓谷歌地图寻找最近的地方,android,google-maps,google-maps-api-2,Android,Google Maps,Google Maps Api 2,我过去常找最近的比萨饼,但它只提供其他最近的地方。有人能告诉我如何找到最近的地方吗 final URIBuilder builder = new URIBuilder().setScheme("https").setHost("maps.googleapis.com").setPath("/maps/api/place/search/json"); builder.addParameter("location", Double.toString(

我过去常找最近的比萨饼,但它只提供其他最近的地方。有人能告诉我如何找到最近的地方吗

            final URIBuilder builder = new URIBuilder().setScheme("https").setHost("maps.googleapis.com").setPath("/maps/api/place/search/json");

            builder.addParameter("location", Double.toString(latitude) + "," + Double.toString(longitude));
            builder.addParameter("radius", "1000");
            builder.addParameter("types", "pizza hut");
            builder.addParameter("sensor", "false");
            builder.addParameter("key", "AIzaSyDS8-gY-KmedXVZx1WGOUdBB66z");
            final HttpUriRequest request = new HttpGet(builder.build());
                HttpClient client = new DefaultHttpClient();
            final HttpResponse execute = client.execute(request);

            final String response;

                response = EntityUtils.toString(execute.getEntity());

                Log.i("response", response);    
    }

你能试试下面的链接吗

https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=mLatitude,mLongitude&radius=5000&types=food&name=cruise&key=API_KEY

希望这能对您有所帮助。

我添加了&keyword=pizza+hut关键字值。它返回正确的值。无论如何,谢谢您的帮助。@sudo,那有什么问题吗?关于半径?现在没有问题。在我使用&type=only之前。我删除了类型并添加了关键字。现在工作正常。