使用适用于 Android 的 Google 文档和 Google 电子表格 API
我计划使用 Google 文档列表和 Google 文档电子表格 API 将数据库从我的应用程序上传到在线电子表格,然后对其进行编辑。
我只是想知道这些 API 是否是使用 Google 文档作为我在应用程序中收集的数据的在线存储空间的正确方法。
我希望我能从一些可能有这方面经验的人那里得到反馈。
下面列出了这两个 API 的链接:
http://code.google.com/apis/documents/
http://code.google.com/apis/spreadsheets/
谢谢提前!
I am planning on using the Google Documents List, and Google Documents Spreadsheet API's for uploading a database from my app to a spreadsheet online and then editing it.
I just wanted to know if these API's would be the right approach for using Google docs as an online storage space for the data that I have collected in my app.
I was hoping that I could just get feedback from some of you who might have experience with this.
The links for both API's are listed below:
http://code.google.com/apis/documents/
http://code.google.com/apis/spreadsheets/
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
要在 Android 平台上访问 Google API,请使用适用于 Java 的 Google API 客户端库 是要走的路。
它包括用于文档和电子表格 API 的示例应用 。
For accessing Google APIs on the android platform, the Google APIs Client Library for Java is the way to go.
It includes sample apps for the Documents and Spreadsheet APIs.
(2016 年 12 月至 2017 年 2 月) 此问题的各个部分现已过时,因为:1) GData API(包括文档列表和电子表格 API)是上一代 Google API。虽然并非所有 GData API 均已弃用,但所有现代 Google API不使用Google 数据协议; 2) Google 文档列表 API 已 替换(和于 2015 年关闭) Google Drive API(移动开发者有特定的Google 云端硬盘 Android API), 3) Google 发布了一个新的2016 年的 Google Sheets API v4(不是 GData),以及 4) Android Studio 现在是优于 Eclipse 的首选 IDE。
为了使用 Google API,您需要获取 适用于 Android 的 Google API 客户端库(或者对于更通用的 Java, Google API 客户端库Java)。现在举一些例子...这里有 Android 快速入门代码示例以及适用于 Sheets API 的更通用的 Java 快速入门代码示例。传递 JavaDocs 参考不会有什么坏处Sheets API 之一。
如果您对 Python 不“过敏”,我还制作了几个视频,其中包含使用 Sheets API 的更多“真实世界”示例(尽管是非移动设备):
最新的 API 提供了旧版本中不可用的功能,即为开发人员提供了对工作表的编程式文档导向访问,就像您正在使用用户界面一样(创建冻结的行、执行单元格格式设置、调整行/列大小、添加数据透视表、创建图表等)但是,要执行文件级访问(例如导入和删除)导出时,您可以改用 Google Drive API - 对于移动设备,有一个特定的 Google 云端硬盘 Android API。
但根据您的用例,我认为您不需要 Drive API(也不需要已弃用的文档列表 API),除非您需要执行文件操作(例如搜索或我上面描述的操作)。您只需使用 Sheets API“将数据库从您的 [Android] 应用上传到在线电子表格,然后对其进行编辑。”我上面关于“将 SQL 数据迁移到工作表”的视频应该为您提供足够的伪代码(这就是 Python,不是吗?)来编写您的应用程序。
要详细了解如何使用 Google API,请观看各种 Google 开发者视频(系列 1 和 系列 2)我正在制作(主要是 Python 或 JavaScript)。
(Dec 2016-Feb 2017) Various parts of this question are now out-of-date as: 1) GData APIs (including both the Documents List and Spreadsheets APIs) are the previous generation of Google APIs. While not all GData APIs have been deprecated, all modern Google APIs do not use the Google Data protocol; 2) the Google Documents List API has been replaced (and shut down in 2015) by the Google Drive API (mobile developers have a specific Google Drive Android API), 3) Google released a new Google Sheets API v4 (not GData) in 2016, and 4) Android Studio is now the preferred IDE over Eclipse.
In order to use Google APIs, you need to get the Google APIs Client Library for Android (or for more general Java, the Google APIs Client Library for Java). Now for some examples... here's the Android quickstart code sample as well as the more general Java Quickstart code sample for the Sheets API. Can't hurt to pass along the JavaDocs reference for the Sheets API either.
If you're not "allergic" to Python, I've also made several videos with more "real-world" examples using the Sheets API (non-mobile though):
The latest API provides features not available in older releases, namely giving developers programmatic document-oriented access to a Sheet as if you were using the user interface (create frozen rows, perform cell formatting, resizing rows/columns, adding pivot tables, creating charts, etc.) However, to perform file-level access such as imports & exports, you would use the Google Drive API instead -- for mobile, there's a specific Google Drive Android API.
But based on your use-case, I don't believe you need the Drive API (nor the deprecated Documents List API) unless you need to perform file operations like searching or those I described just above. You can just use the Sheets API to "upload a database from your [Android] app to a spreadsheet online and then edit it." My one video above on "migrating SQL data to a Sheet" should give you enough pseudocode (that's what Python is, isn't it?) to write your app.
To learn more about how to use Google APIs, check out the variety of Google developer videos (series 1 and series 2) I'm producing (heads-up mostly Python or JavaScript).
就我个人而言,我不喜欢 Google 的 java api 库。老实说,我认为您最好使用 scribe 和 Jackson 来反序列化提要。我们创造了一个你好世界。它包括使用 openid 和 oauth 对电子表格源和反序列化模板的调用。希望有帮助。
链接
Personally I don't like Google's api lib for java. I honestly think you are better off using scribe and jackson to deserialize the feeds. We made a hello world. It includes calls with openid and oauth to spreadsheet feeds and deserialization template. Hope it helps.
link