首页 文章

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

提问于
浏览
0

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

我试过下面的代码:

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

    我不确定你是否可以为这个名字指定多种可能性 .

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

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

相关问题