我正在获取当前位置,然后我必须找到关于半径的餐馆,代码工作正常。但得到谷歌api的回应是,
{ "error_message" : "This IP, site or mobile application is not authorized to use this API key. Request received from IP address 49.248.59.224, with empty referer", "html_attributions" : [], "results" : [], "status" : "REQUEST_DENIED"}
我创建了Android密钥,启用了google place api,google maps api v2
仍然有问题,任何人都可以帮助我,
我的代码在下面
StringBuilder sb = new StringBuilder("https://maps.googleapis.com/maps/api/place/nearbysearch/json?");
sb.append("location="+mLatitude+","+mLongitude);
sb.append("&radius=5000");
sb.append("&types="+type);
sb.append("&sensor=true");
sb.append("&key=xxxxxxxxxxxxxxxxxxxxxx");
答案 0 :(得分:0)
您可能需要使用ip address
注册api key
。访问developers console
并为public ip
添加api key
。
答案 1 :(得分:0)
https://www.dropbox.com/s/noxnowngtqxxhss/2015-08-04_16-15-32.png?dl=0 请参阅Dropbox链接图片,这里是"编辑允许的IP"把它留空所以它将允许所有的ips地址:)