【问题标题】:Request denied while querying the google places api from my android application从我的 android 应用程序查询 google places api 时请求被拒绝
【发布时间】:2012-09-04 13:06:24
【问题描述】:

我正在构建一个 android 应用程序,该应用程序使用 google places api 获取用户位置并返回附近的地点。

我有一个 api 密钥,我正在使用这个网址:

https://maps.googleapis.com/maps/api/place/search/json?location=-33.8670522,151.1957362&radius=500&types=food&name=harbour&sensor=false?key=mykey

我在我的 android 应用程序中不断收到REQUEST_DENIED。该链接在浏览器上运行良好,它返回一个 json。

【问题讨论】:

  • 您是否使用浏览器 API 密钥,因为它在您的浏览器中有效?您应该通过转到您的 Google API 控制台的 API 访问部分来专门为该 Android 应用程序制作一个。如果没有,我想知道你是否解决了这个问题,我使用的是有效的 Android 密钥,但我的请求仍然被拒绝

标签: android google-places-api


【解决方案1】:

【讨论】:

  • 我将问号更改为 & 符号,但仍然无法正常工作。该链接在浏览器上运行良好,我得到一个 json 响应,但不是来自 android 应用程序。
【解决方案2】:

我在从我的 Android 应用程序连接到 Places API 并收到请求被拒绝错误时遇到了同样的问题。下面的帖子解决了我的问题。它解释说,Places API 目前不支持从 API 控制台生成的 Android 或 iOS 密钥。我将为我的应用使用浏览器密钥。

stackoverflow Places API Question

希望这会有所帮助!

【讨论】:

    【解决方案3】:

    我遇到了同样的问题,使用浏览器密钥作为你在 android 上的密钥。这对我有用。创建浏览器密钥时无需填写任何内容。

    【讨论】:

      猜你喜欢
      • 2013-11-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-12-06
      • 1970-01-01
      • 2013-01-17
      • 1970-01-01
      相关资源
      最近更新 更多