按照本教程http://www.androidhive.info/2012/01/android-json-parsing-tutorial,我已将其改编为使用此网址“https://www.googleapis.com/calendar/v3/calendars/[calendar_ID]/events?singleEvents=true&orderBy=startTime&key=[my_API_key]”解析公共Google日历,而不是示例中的网址。这个日历是公开的。
当我执行应用程序时,响应如下:
{
"error": {
"errors": [
{
"domain": "usageLimits",
"reason": "accessNotConfigured",
"message": "Access Not Configured. The API is not enabled for your project, or there is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your configuration.",
"extendedHelp": "https://console.developers.google.com"
}
],
"code": 403,
"message": "Access Not Configured. The API is not enabled for your project, or there is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your configuration."
}
}
问题出在哪里?我做错了什么?
答案 0 :(得分:1)
最后我找到了解决方案。
在此网址https://www.googleapis.com/calendar/v3/calendars/[calendar_ID]/events?singleEvents=true&orderBy=startTime&key=[my_API_key]中,我使用的是Android应用的API密钥。当我为浏览器的API密钥更改此密钥时,问题就消失了。