【问题标题】:How do we get Near By Places from Google Places API in Android?我们如何从 Android 中的 Google Places API 获取 Near By Places?
【发布时间】:2019-07-05 11:18:21
【问题描述】:

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

【问题讨论】:

    标签: android google-maps google-places-api


    【解决方案1】:

    请参阅https://developers.google.com/places/android-sdk/get-api-key#restrict-key,了解如何限制您的 API 密钥与您的 Android 应用一起使用。

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

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

    【讨论】:

    • 我尝试使用 Places SDK for Android 的 PlacesClient.findCurrentPlace(),但我无法使用受限 API 密钥(包名和 SHA1)。我收到一个错误,但理想情况下,我可以将它用作它不是简单的 API 调用,而是它的 Android SDK。任何帮助将不胜感激。
    猜你喜欢
    • 1970-01-01
    • 2015-02-27
    • 1970-01-01
    • 1970-01-01
    • 2014-08-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-05
    相关资源
    最近更新 更多