谷歌放置API没有返回结果

时间:2016-02-14 20:19:15

标签: android google-api gps location google-places-api

google places API返回使用urlConnection从android调用它,以及从凭据中提供的包中调用它。 仍然显示/返回以下作为json数据:

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

尝试链接

https://maps.googleapis.com/maps/api/place/search/json?location=28.6142552,77.09509802&radius=5000&types=atm&sensor=false&key=[MY_API_KEY_for_android]

尝试浏览器密钥或服务器密钥时,提取的json数据为

{ "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"
}

1 个答案:

答案 0 :(得分:0)

error_message一样,您的API密钥未配置为允许此用途。要使用该URL,请检查您

  1. 在Google Developers Console中启用了“Google Places API Web服务”API,
  2. 您正在使用服务器键和
  3. 它没有IP地址限制[或者如果您希望IP地址限制它们与您要查询的IP匹配]。