简体   繁体   English

Android Google Place Picker自动填充功能未显示附近的地方

[英]Android Google Place Picker autocomplete not showing nearby places

I use Google Place API in my app and I have a little issue with Place Picker autocomplete feature. 我在我的应用中使用了Google Place API,我对Place Picker自动完成功能有一点问题。

The autocomplete feature does not show nearby places, but places all around the world. 自动填充功能不会显示附近的地方,而是显示在世界各地。 For example when I search mcdonald it will show me McDonalds in the USA whereas I'm in France. 例如,当我搜索麦当劳时,它会告诉我麦当劳在美国,而我在法国。

The interactive map with its list of nearby places are working great on the other hand, I can see nearby places. 另一方面,交互式地图及其附近地点列表工作得很好,我可以看到附近的地方。 The issue is only with autocomplete feature. 问题仅在于自动填充功能。

I tried to set a LatLngBounds to the builder, but the result is the same. 我试图将LatLngBounds设置为构建器,但结果是相同的。 The interactive map is affected by the LatLngBounds but the autocomplete feature is not. 交互式地图受LatLngBounds影响,但自动完成功能不受影响。

I don't know if it is the normal beahvior or not, the documentation on Place Picker is not really precise and does not mention that. 我不知道它是否是正常的行为,关于Place Picker的文档并不是非常精确,也没有提到。

And I didn't see either in the doc if there is an option to disable autocomplete feature. 如果有禁用自动完成功能的选项,我在文档中也没有看到。

Do you guys have some recommandations for me ? 你们有人为我做过一些推荐吗?

Add location and radius parameters, and try searching again, eg; 添加locationradius参数,然后再次尝试搜索,例如;

https://maps.googleapis.com/maps/api/place/autocomplete/json?input=Mcdonalds&key=API_KEY&location=48.992899,%202.522523&radius=100000

For more information https://developers.google.com/places/web-service/autocomplete 有关详情,请访问https://developers.google.com/places/web-service/autocomplete

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM