How to get 20+ result from Google Places API?

后端 未结 7 1846
一整个雨季
一整个雨季 2020-12-02 10:22

I am developing an app in which I am getting the list of ATM\'s near by the user. For that I am using Google Places API, but every time it returns 20 result only. I want to

7条回答
  •  悲&欢浪女
    2020-12-02 11:00

    As per the documentation:

    https://developers.google.com/places/web-service/search#PlaceSearchResponses

    EDIT: Place API now supports pagination of up to 60 results. See below for details.

    The Places API will return up to 20 establishments per query; however, each search can return as many as 60 results, split across three pages. If your search will return more than 20, then the search response will include an additional parameter — next_page_token. Pass the value of next_page_token to the page_token parameter of a new place search to see the next set of 20 results.

    There is also strict terms of service that specify you cant Pre-Fetch, Cache, or Store Content unless it is the content identifier or key you are permitted to store i.e. reference token from a places search:

    https://cloud.google.com/maps-platform/terms/?_ga=#3-license

    In regards to not being able to find ATM's in India. All places are categorized under the type establishment until Google has enough metadata about a place to categorize it under more specific place types like ATM, cafe, bar etc. A work around that may find more results is to use the keyword parameter in your request with something like 'ATM', 'bank' or 'finance' as the value. As per the documentation:

    https://developers.google.com/places/web-service/search#PlaceSearchRequests

    The keyword parameter is matched against all available fields, including but not limited to name, type, and address, as well as customer reviews and other third-party content.

提交回复
热议问题