android - 我们如何从 Android 中的 Google Places API 获取附近的地点?

标签 android google-maps google-places-api

研究如何为 Android 应用程序配置 Google Places API key ,因为 API 限制限制我们基于引用网站。 现在 Google 将 Place API 视为 Web 服务,因此必须使用 IP 地址限制 API key 。所以我在 android 代码中得到了空结果,它说“API key 不受限制”,所以现在如何在 Android 应用程序中使用 API key 来接近地点结果。

最佳答案

请参阅https://developers.google.com/places/android-sdk/get-api-key#restrict-key有关限制您的 API key 用于您的 Android 应用程序的说明。

要使用 Places SDK for Android 实现附近地点的显示,您有两种选择:

  1. 使用PlacesClient.findCurrentPlace()立即获取设备当前位置周围最有可能的地点。
  2. 使用AutocompletesetLocationBias or setLocationRestriction允许用户键入他们想要在特定位置周围搜索的特定地名或查询。

关于android - 我们如何从 Android 中的 Google Places API 获取附近的地点?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56902056/

相关文章:

android - 使用底部应用栏选项卡导航 - flutter

android - 如何将默认导航选项卡 View 更改为自定义选项卡 View ?

android - 为 android 中视频显示的纵横比变化调整表面 View

java - Kotlin:如何获取文件(IMAGE)的创建日期?

javascript - Google map 禁止用户在所有事件上平移

java - Android Studio "error: incompatible types: Fragment cannot be converted to SupportMapFragment"

javascript - 将标记添加到谷歌地图,引用 map 但不重新实例化它

google-maps - 为什么有些结果显示在 Google map 中,但不显示在 Places API 结果中?

google-places-api - Google Maps Places api,如何从标记中获取标准信息窗口内容

ios - Google Places API、GMSAutocomplete 搜索仅适用于城市、国家 iOS Swift