当一个Android附近的地方得到错误

时间:2018-05-10 11:12:25

标签: android google-maps

当我点击医院附近的地方时出现错误..

Returning data= {"error_message" : "This IP, site or mobile application is not authorized to use this API key. Request received from IP address 103.247.48.75, with empty referer",   "html_attributions" : [],   "results" : [],   "status" : "REQUEST_DENIED"}

05-10 16:22:38.297 4057-4057/pilojan.slbroute D/json data: {   "error_message" : "This IP, site or mobile application is not authorized to use this API key. Request received from IP address 103.247.48.75, with empty referer",   "html_attributions" : [],   "results" : [],   "status" : "REQUEST_DENIED"}

05-10 16:22:38.297 4057-4057/pilojan.slbroute D/nearbyplacesdata: called parse method
05-10 16:22:45.222 4057-4057/pilojan.slbroute D/MapsActivity: url = https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=8.9908983,80.599&radius=10000&type=hospital&sensor=true&key=AIzaSyBFJUy7jJJaOECHEtVFs2WkTalBwtinQao
05-10 16:22:45.267 4057-4275/pilojan.slbroute 

2 个答案:

答案 0 :(得分:0)

我希望您在项目的谷歌控制台中启用地方api服务,并在网址api键中定义密钥..

参考下面的链接我传递了关键位置api密钥,我得到数据..

https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-33.8670522,151.1957362&radius=1500&type=restaurant&keyword=cruise&key=AIzaSyC4dszhtREoFFtRVGgt2obok0Ux25Y8w7Y

答案 1 :(得分:0)

错误消息表明应用程序未被授权使用Api密钥。要能够使用API​​密钥,请按照以下步骤操作:

  1. 转到[开发者控制台](https://console.cloud.google.com/getting-started)。
  2. 在凭据中的Create Credentials下,选择API密钥。
  3. 点击密钥名称,确保应用程序限制为"无"。然后保存更改。
  4. 现在在向附近地点发出请求时使用此API密钥。
  5. 希望这个答案能够帮助你和其他观众。