繁体   English   中英

显示谷歌地图搜索android附近的地方

[英]Showing nearby places in google map search android

我不想在我的应用程序中有不同的国家搜索建议(图片)

我想在谷歌地图应用程序中有正确或最近的建议(图片)

我已经使用此代码进行了测试

autocompleteFragment = (PlaceAutocompleteFragment)
                getFragmentManager().findFragmentById(R.id.place_autocomplete_fragment);
AutocompleteFilter typeFilter = new AutocompleteFilter.Builder()
                .setTypeFilter(AutocompleteFilter.TYPE_FILTER_REGIONS)
                .build();  

autocompleteFragment.setFilter(typeFilter);

当我在搜索栏中输入时,我想显示附近的地方。 我的问题是当在搜索栏中输入一个字符时,该字符与其他国家/地区相关,作为建议,我希望它是最接近的一个。 换句话说,搜索与Android谷歌地图应用程序非常相似。

AutocompleteFilter filter = new AutocompleteFilter.Builder()
            .setTypeFilter(AutocompleteFilter.TYPE_FILTER_CITIES)
            .build();

AutoCompleteSearch组件,不显示附近的地方。 我通过使用Google Map网络服务API实现了目标。

Web-API: maps.googleapis.com/maps/api/place/nearbysearch (GET)
参数:key(您的API密钥),
位置(纬度+ “” +朗),
半径(5000),
传感器(真)
注意:我启用了Google Places API Web服务。

暂无
暂无

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

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