你真正需要的是pagetoken什麼:
public PlacesList search(double latitude, double longitude, double radius, String types)
throws Exception {
try {
HttpRequestFactory httpRequestFactory = createRequestFactory(HTTP_TRANSPORT);
HttpRequest request = httpRequestFactory
.buildGetRequest(new GenericUrl("https://maps.googleapis.com/maps/api/place/search/json?"));
request.getUrl().put("key", YOUR_API_KEY);
request.getUrl().put("location", latitude + "," + longitude);
request.getUrl().put("radius", radius);
request.getUrl().put("sensor", "false");
request.getUrl().put("types", types);
PlacesList list = request.execute().parseAs(PlacesList.class);
if(list.next_page_token!=null || list.next_page_token!=""){
Thread.sleep(4000);
/*Since the token can be used after a short time it has been generated*/
request.getUrl().put("pagetoken",list.next_page_token);
PlacesList temp = request.execute().parseAs(PlacesList.class);
list.results.addAll(temp.results);
}
return list;
} catch (HttpResponseException e) {
return null;
}
}
從引用:Google Places API : Number of results
你可以這樣做很容易,有很多查詢參數可以獲得合併記錄,滿足查詢條件,使用半徑= 500,類型=食品等等。我建議從[地方搜索](https://developers.google.com/places/documentation/search)閱讀谷歌地方API –
@jitainsharma:我之前搜索過,但沒有找到任何匹配的東西我的需求,我認爲你不會得到我的問題,我不需要做一個過濾器,因爲我已經這樣做了,但我想刪除一些信息,回到我減少字符串結果... – Oussaki