[英]Showing nearby places in google map search android
I don't want have different countries search suggestions in my app(Image) 我不想在我的应用程序中有不同的国家搜索建议(图片)
I want to have correct or nearest suggestions in google map app(Image) 我想在谷歌地图应用程序中有正确或最近的建议(图片)
I have tested with this code 我已经使用此代码进行了测试
autocompleteFragment = (PlaceAutocompleteFragment)
getFragmentManager().findFragmentById(R.id.place_autocomplete_fragment);
AutocompleteFilter typeFilter = new AutocompleteFilter.Builder()
.setTypeFilter(AutocompleteFilter.TYPE_FILTER_REGIONS)
.build();
autocompleteFragment.setFilter(typeFilter);
I want to show nearby places when I am typing in search bar. 当我在搜索栏中输入时,我想显示附近的地方。 My problem is when one character was entered in search bar, that character related other country places coming as suggestions, I want it to be very nearest one. 我的问题是当在搜索栏中输入一个字符时,该字符与其他国家/地区相关,作为建议,我希望它是最接近的一个。 In other words the search is much similar like android google maps app. 换句话说,搜索与Android谷歌地图应用程序非常相似。
AutocompleteFilter filter = new AutocompleteFilter.Builder()
.setTypeFilter(AutocompleteFilter.TYPE_FILTER_CITIES)
.build();
AutoCompleteSearch component which doesn't show nearby places. AutoCompleteSearch组件,不显示附近的地方。 I had achieved by using Google Map web-service API. 我通过使用Google Map网络服务API实现了目标。
Web-API: maps.googleapis.com/maps/api/place/nearbysearch (GET)
Web-API: maps.googleapis.com/maps/api/place/nearbysearch (GET)
parameters: key(Your API key), 参数:key(您的API密钥),
location(lat+","+lang), 位置(纬度+ “” +朗),
radius(5000), 半径(5000),
sensor(true) 传感器(真)
NOTE: I enabled Google Places API Web Service. 注意:我启用了Google Places API Web服务。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.