【发布时间】:2013-10-10 12:30:18
【问题描述】:
我很难从 Google Places API 获得有效的自动完成响应。我正在使用基于 [their example}(https://developers.google.com/places/training/autocomplete-android) 的代码(有趣的是,它使用的是 seemingly invalid country code of "uk")。
我在我的 Google 代码控制台中启用了 Places API。 我的 API 密钥是在几周前首次启用 Maps API 时生成的,而我使用的 MapFragment 运行良好,因此我没有理由怀疑 API 密钥无效。
我使用的网址是https://maps.googleapis.com/maps/api/place/autocomplete/json?input=New+York&sensor=false&key=my_valid_api_key&components=country:us
我总是收到{"status":"REQUEST_DENIED","predictions":[]} 作为我的回复。
我已多次验证我的网址格式正确并符合Places API autocomplete endpoint 的要求,但我没有得到预期的响应。
我已经看到了许多关于如何在 SO 和其他地方解决此问题的建议,但没有一个对我有用(即,使用 http 而不是 https,使用端口 443 等)我已经尝试过这些合理的组合,响应没有变化。
请帮我找出我做错了什么。
【问题讨论】:
标签: android autocomplete google-places-api