Java 谷歌设置查询限制
我用谷歌地图API开发了一个android应用程序。 当我从本地提供商处使用我的家庭互联网时,应用程序正在运行 但是,当我将互联网改为AT&T时,我发现以下错误: Places错误抱歉,已达到google Places的查询限制 我不明白为什么会这样。这两种互联网连接之间有区别吗Java 谷歌设置查询限制,java,android,Java,Android,我用谷歌地图API开发了一个android应用程序。 当我从本地提供商处使用我的家庭互联网时,应用程序正在运行 但是,当我将互联网改为AT&T时,我发现以下错误: Places错误抱歉,已达到google Places的查询限制 我不明白为什么会这样。这两种互联网连接之间有区别吗 谢谢我想你已经超越了谷歌地图API的使用范围。如果超出google map API的使用范围,响应状态代码将超过查询限制我假设您也会这样做 protected void onPostExecute(String fil
谢谢我想你已经超越了谷歌地图API的使用范围。如果超出google map API的使用范围,响应状态代码将超过查询限制我假设您也会这样做
protected void onPostExecute(String file_url) {
// dismiss the dialog after getting all products
pDialog.dismiss();
// updating UI from Background Thread
runOnUiThread(new Runnable() {
public void run() {
/**
* Updating parsed Places into LISTVIEW
* */
// Get json response status
String status = nearPlaces.status;
// Check for all possible status
if(status.equals("OK")){
// Successfully got places details
if (nearPlaces.results != null) {
// loop through each place
for (Place p : nearPlaces.results) {
HashMap<String, String> map = new HashMap<String, String>();
// Place reference won't display in listview - it will be hidden
// Place reference is used to get "place full details"
map.put(KEY_REFERENCE, p.reference);
// Place name
map.put(KEY_NAME, p.name);
// adding HashMap to ArrayList
placesListItems.add(map);
}
// list adapter
ListAdapter adapter = new SimpleAdapter(MainActivity.this, placesListItems,
R.layout.list_item,
new String[] { KEY_REFERENCE, KEY_NAME}, new int[] {
R.id.reference, R.id.name });
// Adding data into listview
lv.setAdapter(adapter);
}
}
else if(status.equals("ZERO_RESULTS")){
// Zero results found
alert.showAlertDialog(MainActivity.this, "Near Places",
"Sorry no places found. Try to change the types of places",
false);
}
else if(status.equals("UNKNOWN_ERROR"))
{
alert.showAlertDialog(MainActivity.this, "Places Error",
"Sorry unknown error occured.",
false);
}
else if(status.equals("OVER_QUERY_LIMIT"))
{
alert.showAlertDialog(MainActivity.this, "Places Error",
"Sorry query limit to google places is reached",
false);
}
else if(status.equals("REQUEST_DENIED"))
{
alert.showAlertDialog(MainActivity.this, "Places Error",
"Sorry error occured. Request is denied",
false);
}
else if(status.equals("INVALID_REQUEST"))
{
alert.showAlertDialog(MainActivity.this, "Places Error",
"Sorry error occured. Invalid Request",
false);
}
else
{
alert.showAlertDialog(MainActivity.this, "Places Error",
"Sorry error occured.",
false);
}
}
});
}
您可以通过以下方式超过Google Maps API Web服务使用限制:
每天发送的请求太多。
发送请求太快,即每秒发送的请求太多。
发送请求的速度太快,时间太长,或者滥用web服务。
超过其他使用限制,例如,高程API中每个请求的点数
上述问题可以通过结合两种方法来解决:
通过优化应用程序以更高效地使用web服务来降低使用率。
在可能的情况下,通过为您的Maps API购买额外许可证来增加使用限制
有关更多信息,请参见此处->
如果您有任何问题,请随时在评论中提问:)只需在提问前用谷歌搜索即可。您使用的是免费版本的webservice,所以google只为您提供一小部分配额。在API中,所有内容都解释得非常详细。
else if(status.equals("OVER_QUERY_LIMIT"))
{
alert.showAlertDialog(MainActivity.this, "Places Error",
"Sorry query limit to google places is reached",
false);
}