从 Android 上的 Google 日历中以 JSON 格式提取数据
我正在使用 Android SDK 级别 8,Java。我有一个带有 WebView 的应用程序,我想在其中导入 JSON。
我想要实现的是: 不过,请向 Google Calendar API v3 发送 HTTP 请求并接收原始 JSON 格式的数据,使用 Android 帐户管理器验证请求。我一直在研究 GData Java 客户端,更具体地说是 Calendar Android Sample,它可以正确进行身份验证,但我想特别避免以下事情:
- 使用 GData API - 不可接受,因为我想要一个原始 JSON 字符串。
- 直接通过 WebView 中的 JavaScript 提取数据 - 不可接受,因为我想在 Java 中实现 SyncProvider 来更新 JSON 字符串,
我发现了有关该问题的一些信息,例如: http://code.google.com/p/google- api-java-client/wiki/AndroidAccountManager
但是,所有示例都与 GData 连接。另一方面,在探索 Google Calendar v3 API 页面时,我无法弄清楚如何使用帐户管理器中的身份验证令牌进行身份验证。
总而言之:如何通过对日历 API v3 的纯 HTTP 请求检索 JSON,使用 Java 中的帐户管理器的令牌对用户进行身份验证。
I'm using Android SDK level 8, Java. I have an app with a WebView and I want to import JSON in it.
What I want to achieve is:
Send HTTP requests to the Google Calendar API v3 and receive data in raw JSON, however, authenticating the request using the Android account manager. I've been looking at the GData Java Client, more specifically at the Calendar Android Sample, which authenticates properly, but I want to specifically avoid the following things:
- Using the GData API - unacceptable since I want a raw JSON string.
- Pulling the data directly through JavaScript in the WebView - unacceptable since I would want to implement a SyncProvider in Java to update the JSON string
I found some information about the issue, for example:
http://code.google.com/p/google-api-java-client/wiki/AndroidAccountManager
However, all the examples are connected with GData. On the other hand, exploring the Google Calendar v3 API page, I could not figure out how to authenticate with an auth token from the Account Manager.
In summation: how to retrieve JSON through plain HTTP requests to the Calendar API v3, authenticating the user with the token from the account manager, in Java.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论