1
A
回答
2
20是不幸的。你可以做的是做幾個不同半徑的請求,併合並/結合在一起。
2
你可以寫做得到60個結果(20頁)在時間的方法,但是會出現在得到所有結果的延遲 -
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;
}
}
相關問題
- 1. 緩存Google Places API結果
- 2. Google Places API與Google地圖結果
- 3. Google Places API - 響應數量
- 4. Google Maps API Places搜索獲取搜索結果數量
- 5. Google Places API沒有返回結果?
- 6. ListView中的Google Places API結果
- 7. Google Places API - RadarSearch結果令人困惑
- 8. Google Maps Places沒有結果Api
- 9. 從Google Places API解析JSON結果
- 10. Google Places API結果的問題
- 11. Google Places API Places Types
- 12. Google Places API返回稀疏結果vs Google Places iPhone應用程序
- 13. Google Places API Places照片
- 14. Google Places API Swift
- 15. Google Maps Places API
- 16. Google Places API - android
- 17. Google Places API
- 18. Google Places API cors
- 19. Google Places Api Android
- 20. Google Places API subway_station ,?
- 21. Google places Api Key
- 22. Google Places API Warning
- 23. Google Places JS API weekday_text
- 24. Google Places API違例
- 25. Google Places API LatLng Query
- 26. Google Places API查詢
- 27. Google Places API限制
- 28. Google API for Restaurants Places
- 29. Google Places API屬性
- 30. Google Places API錯誤