谷歌广告搜索有多个地名android

时间:2012-09-19 12:17:55

标签: android google-maps google-maps-api-3 google-places-api

您好,我想根据该地点的纬度,经度,半径和名称搜索地点。

我尝试过以下代码:

HttpRequestFactory httpRequestFactory = createRequestFactory(HTTP_TRANSPORT);
HttpRequest request = httpRequestFactory
                .buildGetRequest(new GenericUrl("https://maps.googleapis.com/maps/api/place/search/json?"));
request.getUrl().put("key", API_KEY);
request.getUrl().put("location", _latitude + "," + _longitude);
request.getUrl().put("name", "Pacific Beach");
request.getUrl().put("radius", _radius); // in meters
request.getUrl().put("sensor", "false");

我已经过了圣地亚哥的经纬度,我成功地获得了太平洋海滩的位置。

现在我想从api位置获得多个名称 现在,如果我在上面编写代码并进行以下更改:

      request.getUrl().put("name","Pacific Beach|Gaslamp|Ocen Beach|Uptown|Hilcrest|Mission Valley|Fashion Valley|North Park");

我在这里得到“不是任何地点”。

任何人都可以告诉我应该如何编写上面的代码。

我不知道我是否想要多次搜索结果我必须写。

1 个答案:

答案 0 :(得分:0)

我不确定您是否可以为该名称指定多种可能性。

要尝试的一件事可能是添加多个name参数,方法是指出它们是一个数组(name[])。可能根本不工作,我还没有测试过。

否则,您可能必须获得所有可能的结果,然后在收到后对其进行过滤。

相关问题