2

我正在开发使用谷歌位置自动完成 API 的 android 应用程序。

当试图点击以下 URL

https://maps.googleapis.com/maps/api/place/autocomplete/json?input=Vict&types=geocode&sensor=false&language=en&key=apiKey

我得到了如下回复。

{“预测”:[],“状态”:“REQUEST_DENIED”}

我从Google API 控制台下方的链接获得了 API 密钥

我也启用了 Google Maps API v3 服务。根据 API 文档,REQUEST_DENIED 响应通常是由于缺少传感器参数,但我已经提供了这些参数。在浏览器中直接点击上面的 URL 后,我也收到了 REQUEST_DENIED 响应。我还有什么需要做的吗?

4

4 回答 4

4

你确定你的密钥是正确的并且你有足够的配额吗?尝试生成一个新密钥并检查您的推荐是否正确/设置为空。

您可能还需要等待最多 5 分钟才能激活密钥。

FWIW 我用自己的密钥测试了你的 URL,它运行良好。

于 2012-02-05T22:37:50.980 回答
2

在为我的 android 应用程序使用 Google Places API 时,我也遇到了同样的问题“REQUEST_DENIED”。根据 Google API 控制台帮助“Android 和 iOS 密钥仅受某些 API 支持,例如 Google Maps Android API 或 Google Maps SDK for iOS。” (https://developers.google.com/console/help/)。

在我的情况下,通过使用“用于 Bowser 应用程序的密钥”而不是使用 android/iOs 密钥解决了问题。

于 2013-11-28T12:30:59.063 回答
0

我没有看到API 页面http://code.google.com/apis/maps/documentation/places/#PlaceSearches上列出的输入参数

它有什么作用?如果您确实需要它,请尝试将其移至最后一项。或者只是尝试先删除它,看看它是否有效。

于 2012-02-04T17:19:49.580 回答
0

The problem that you are facing is may be related to API_KEY.You inserted something like
letter "l" instead of capital "i". Capital i and el(l) looks same in the xcode environment.Try to insert correct letter will solve the issue.

于 2013-10-28T06:35:51.657 回答