Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 查找附近的位置从google api获得响应,api密钥未授权_Android_Api_Google Maps_Android Fragments_Google Maps Api 3 - Fatal编程技术网

Android 查找附近的位置从google api获得响应,api密钥未授权

Android 查找附近的位置从google api获得响应,api密钥未授权,android,api,google-maps,android-fragments,google-maps-api-3,Android,Api,Google Maps,Android Fragments,Google Maps Api 3,我得到了我目前的位置,然后我必须找到目前的餐厅的半径,代码工作正常。但谷歌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

我得到了我目前的位置,然后我必须找到目前的餐厅的半径,代码工作正常。但谷歌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"}
我已经使用启用的google place api、google maps api v2创建了Android密钥
还有问题,谁能帮我一下吗, 我的代码在下面

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");

您可能需要使用您拥有的
api密钥
注册您的
ip地址
。访问
developers console
并为
api密钥添加
public ip


请参阅dropbox链接图片,在“编辑允许的IP”中留空,这样它将允许所有IP地址:)

在api密钥激活期间,您是否选择了“允许的任何IP”选项?请告诉我如何注册公共IP地址是否需要支付注册费?@Vijay无需支付注册费,请离开“允许的IP”如HardikHey hardik所述为空。这意味着我必须创建服务器密钥,对吗?对于google place apiYes,您必须创建服务器密钥。顺便问一下,您在“sb.append”(&key=xxxxxxxxxxxxxxxxxxxxxxxx)中使用的密钥是什么;“?我正在使用服务器密钥并选择了所有类型的ip,但仍然不工作,并收到消息“此ip、站点或移动应用程序无权使用此API密钥。”。从IP地址49.248.59.224接收到请求,引用为空。“