Google places API return a single type “car_repair”

前端 未结 3 707
囚心锁ツ
囚心锁ツ 2020-12-17 15:43

I\'m using Google places API and it is returning all the places in my location. However I only want it to return a type for \"car-repair\" I think I nearly have it but I\'m

3条回答
  •  [愿得一人]
    2020-12-17 16:35

    Because this API return the place type inside a scope. There is a method may improve the result but still not optimal, which is called setLatLngBounds.The link is https://developers.google.com/android/reference/com/google/android/gms/location/places/ui/PlacePicker.IntentBuilder#public-method-summary I have tried this API before and find it is totally a mess in some degree. For example, if you want to find restaurant inside a university, this API will not only return you the restaurant but also many other types like University. Setting a bound maybe be good but still get annoying result if you only use the API. If you just want the type of car-repair, I suggest you write a filter to filter other types and only keep car-repair type and relevant information.

提交回复
热议问题