Google Places API始终返回错误

Gue*_*ess 12 android google-places-api

我在我的Android应用程序中集成了Google Places API.我已阅读API文档在这里看到.

我已激活Google Places Api for android并生成浏览器密钥,当我调用api时收到错误响应 -

{"error_message" : "This API project is not authorized to use this API.Please ensure that this API is activated in the APIs Console: Learn more: https://code.google.com/apis/console",
  "html_attributions" : [],
  "results" : [],
  "status" : "REQUEST_DENIED"
}
Run Code Online (Sandbox Code Playgroud)

我也尝试创建android键,它返回 -

{
 "error_message" : "This IP, site or mobile application is not authorized to use this API key.",
 "html_attributions" : [],
 "results" : [],
 "status" : "REQUEST_DENIED"
}
Run Code Online (Sandbox Code Playgroud)

我没有得到我的代码中的问题.

任何帮助表示赞赏.提前致谢.

检查API控制台 - 在此输入图像描述

War*_*an- 17

我有同样的问题.在我的情况下,问题是我试图通过这个url使用简单的HttpUrlconnection发送请求:

 https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=62.25227243964484%2C59.12338379770518&radius=500&key=my_key
Run Code Online (Sandbox Code Playgroud)

my_key是Google Places API for Android的关键,但是当我切换到Google Places API Web服务时,这很好用.对于使用适用于Android的Google Places API的密钥,您应该遵循以下指南https://developers.google.com/places/android/


Fra*_*uts 9

您似乎正在使用Places API网络服务,该服务需要启用"Google Places API网络服务"并提供服务器密钥:https://developers.google.com/places/webservice/intro#Authentication

由于您正在构建Android应用程序,因此您可能需要尝试我们刚刚在3月发布的Android版Places API :)该文档位于https://developers.google.com/places/android/

我希望这有帮助!