Android Google Place Api下一页
问题描述:
我使用HttpConnection调用GooglePlaceAPI。Android Google Place Api下一页
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location="+latitude+","+longtitude+"&types=" + params[0] + "&radius=" + params[1] + "&key=" + GOOGLE_KEY
如果结果超过20,我得到20+结果。我无法得到1-20的结果。但我想获得所有结果。我听说next_page_token,但我不知道如何使用。
我该如何使用我的页面令牌或next_page_token?我如何解决这个问题?
答
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location="+latitude+","+longtitude+"&types=" + params[0] + "&radius=" + params[1] + "&key=" + GOOGLE_KEY
解析next_page_token
从上面的API JSON响应
然后用pagetoken='next_page_token'
调用API再次低于
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location="+latitude+","+longtitude+"&pagetoken='next_page_token'&types=" + params[0] + "&radius=" + params[1] + "&key=" + GOOGLE_KEY
给出这会给你未来20个结果..继续从API调用next_page_token解析然后再次使用next_page_token调用API以获得更多结果
请参阅文档中的示例:https://developers.google.com/places/w EB-服务/搜索#PlaceSearchPaging – spiv