简体   繁体   English

如何在没有适用于Android的地点SDK的情况下实现谷歌地点自动完成搜索框?

[英]how to implement google places autocomplete search box without places SDK for android?

I'm developing an android application that uses Uber like google maps place picker using kotlin.我正在开发一个使用 Uber 的 android 应用程序,比如使用 kotlin 的谷歌地图地点选择器。 I've achieved all the required functionality but I couldn't able to find an updated tutorial on implementing place search autocomplete EditTextView.我已经实现了所有必需的功能,但我找不到关于实现地点搜索自动完成 EditTextView 的更新教程。

I wanted to use google Places SDK for android to implement the earch feature, it seems the feature is depreciated and be turned off on July, 2019(as mentioned here: Places SDK for android ).我想使用适用于 android 的 google Places SDK 来实现该功能,该功能似乎已折旧并于 2019 年 7 月关闭(如此处所述:适用于 Android 的 Places SDK )。

It would be great if someone could help me create an EditText in android app when user types places it suggests places according to the search term.如果有人可以帮助我在 android 应用程序中创建一个 EditText,当用户输入它根据搜索词建议地点时,那就太好了。

Only the Place Picker widget is deprecated , not Autocomplete.弃用位置选取器小部件,而不是自动完成。 You can use Place Autocomplete , either as a widget which gives you a pre-built search bar or programmatically to build a custom search UI.您可以将Place Autocomplete用作为您提供预构建搜索栏的小部件,也可以以编程方式构建自定义搜索 UI。 For the best user experience, define how you want to constrain results based location and/or types of places depending on your use case.为了获得最佳用户体验,请根据您的用例定义基于结果的位置和/或地点类型的约束方式

Sample code for a full Autocomplete implementation is on Github, but only in Java for now.完整自动完成实现的示例代码在 Github 上,但目前仅在 Java 中。

As an alternate to autocomplete feature by Google, one can opt for Places Search API that requests to search for basic fields against basic text.作为 Google 自动完成功能的替代方案,人们可​​以选择Places Search API,该 API 请求根据基本文本搜索基本字段。 That will cost much less as compared to autocomplete feature.与自动完成功能相比,这将花费更少。 Basic fields include formatted_address, geometry, icon,name, permanently_closed, photos, place_id,plus_code, types that would be more than enough for someone's case.基本字段包括formatted_address、geometry、icon、name、permanent_closed、photos、place_id、plus_code,这些类型对于某人的情况来说已经足够了。

You can compare cost here .您可以在此处比较成本。

So you can use some debounce and mechanisms to build your own search UI.因此,您可以使用一些去抖动和机制来构建自己的搜索 UI。

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

相关问题 如何在我的Android应用中的搜索小部件上实现Google Places自动完成功能? - How do I implement Google places autocomplete on a search widget in my android app? 如何在Android中集成Google Places自动完成功能Google Places SDK折旧后 - How To Integrate Google Places Autocomplete In android After google places sdk is depreciated Android:按名称搜索位置,无需使用 Google 地方信息或地图 SDK - Android: Search location by Name without using Google Places or Maps SDK Android:如何使用Google Places API(自动填充)搜索附近的酒店? - Android: How to search for nearby hotels using the Google Places API (Autocomplete)? 如何以编程方式实现谷歌地点自动完成 - How to implement google places autocomplete programmatically 如何在Android中为Google Places使用自动完成功能 - How to use Autocomplete for google places in android Google Places AutoComplete + Android Fragment - Google Places AutoComplete + Android Fragment Google Places自动完成Android-无法正常工作 - Google Places autocomplete Android - Not working Google将自动完成功能置于Android之外 - Google places Autocomplete not working Android 如何使用Google Places API搜索地址/地点? 安卓系统 - How to use Google Places API to search for addresses/places? Android
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM