使用地理位置 API
每次我发送发布请求时,我都会收到错误代码:403 Acess not Configured的响应。
我已按照 Google API 控制台中提到的所有步骤进行操作。
我正在使用以下网址。
URL="https://www.googleapis.com/geolocation/v1/geolocate?key=" 和 API_KEY="<"My_Key">"
这是我的代码
HttpClient client = new DefaultHttpClient();
HttpConnectionParams.setConnectionTimeout(client.getParams(), 10000);
HttpResponse response;
try {
HttpPost post = new HttpPost(URL + API_KEY);
StringEntity se = new StringEntity(mRequestString);
post.addHeader("content-type", "application/json");
post.setEntity(se);
response = client.execute(post);
/* Checking response */
if (response != null) {
InputStream in = response.getEntity().getContent();
mJSONResponse = convertStreamToString(in);
}
} catch (Exception e) {
e.printStackTrace();
}
return mJSONResponse;
我总是得到的 JSON 响应是:
{
"error"{
errors: [
{
"domain" : "usageLimits"
"reason" : "accessNotConfigured"
"message" : "Access Not Configured"
}
],
"code" :403
"message" :"Access Not Configured"
}
}
请任何人帮助我解决这个问题......