[英]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.