簡體   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