研究如何为 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 实现附近地点的显示,您有两种选择:
- 使用
PlacesClient.findCurrentPlace()
立即获取设备当前位置周围最有可能的地点。 - 使用Autocomplete与
setLocationBias
orsetLocationRestriction
允许用户键入他们想要在特定位置周围搜索的特定地名或查询。
关于android - 我们如何从 Android 中的 Google Places API 获取附近的地点?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56902056/