简体   繁体   English

适用于Android的Google Drive \\ Docs API

[英]Google Drive\Docs API for Android

I integrated Dropbox with my app in a matter of hours as the SDK was clearly described and had good examples of usage. 我在几个小时内将Dropbox与我的应用程序集成在一起,因为SDK已经清楚地描述并且有很好的使用示例。

Google Drive seems to only have a "one size fits all" Gdata SDK which is very heavy (with the many dependencies, it triples the size of my app) and not very intuitive as it is so low level. 谷歌云端硬盘似乎只有一个“一刀切”的Gdata SDK非常沉重(有很多依赖项,它的应用程序大小是三倍)而且不是很直观,因为它的级别太低了。 I'm sure it makes perfect sense when you know how to use it but as I cannot find any real samples of usage I am really struggling. 当你知道如何使用它时,我确信这是完全合理的,但由于我找不到任何真正的使用样本,我真的很挣扎。

Are there any sample apps available that I can look at and learn from? 是否有可供查看和学习的示例应用程序? If not, if anybody has a simple example of uploading and downloading files to get me started it would be much appreciated. 如果没有,如果有人有一个简单的上传和下载文件的例子让我开始,将不胜感激。

EDIT: Since we launched the Google Drive SDK v2 the preferred way is to use the Drive API (and not the Document List API). 编辑:自从我们推出Google Drive SDK v2以来,首选方法是使用Drive API(而不是文档列表API)。 There is a full-access scope which gives you access to listing and reading all the drive files and which can be used in Android apps easily since our newer client library is Android-friendly! 有一个完整的访问范围,您可以轻松访问列出和阅读所有驱动器文件,并且可以轻松地在Android应用程序中使用,因为我们的新客户端库对 Android友好! I also recommend watching this talk from Google IO which is explains how to integrate mobile apps with Drive. 我还建议观看Google IO的这个演讲,其中介绍了如何将移动应用与云集成。

You can also use the per-file scope and integrate with the Drive Android App intents. 您还可以使用每个文件范围并与Drive Android App意图集成

We are coming with full sample apps and dev guides so please stay put. 我们将提供完整的示例应用程序和开发指南,敬请期待。


This has already been answered in this SO post . 这个SO帖子已经回答了这个问题

Basically currently the Google Drive SDK is targeted at Chrome Web Store web applications. 目前,Google Drive SDK主要针对Chrome Web Store网络应用程序。 To use Google Drive on Android today you will have to use the GData Document List API. 要在Android上使用Google云端硬盘,您必须使用GData文档列表API。

The GData client libraries are older (pre-Android world :)) and don't play well with Android. GData客户端库较旧(Android之前的世界:))并且与Android无法很好地兼容。 As explained in the other post by Alain you have the choice of still trying to use the GData client library or use the newer google-api-java-client but since it doesn't have Document List API service classes you will have to manually implement it. 正如Alain在另一篇文章中所解释的那样,您可以选择仍然尝试使用GData客户端库或使用较新的google-api-java-client,但由于它没有Document List API服务类,因此您必须手动实现它。

Probably the simplest and most lightweight option would be to use the HTTP based REST protocol of the API directly along with a good XML parser. 可能最简单,最轻量级的选择是直接使用API​​的基于HTTP的REST协议以及良好的XML解析器。 The protocol is described in the documentation of the Google Document List API just find the tabs that reads "protocol" wherever there is code samples in the page. 该协议在Google Document List API文档中有所描述,只要在页面中有代码示例的地方找到“协议”的选项卡。

Last option you wait until we eventually release something better and newer that plays well with Android :) 最后一个选项,你等到我们最终发布更好的东西,更新的,与Android播放良好:)

Note that the sample app that they published for using Google Drive (dredit) includes jars for Android: 请注意,他们针对使用Google云端硬盘(dredit)发布的示例应用包括适用于Android的广告:

/dredit/war/WEB-INF/lib/google-api-client-android2-1.8.0-beta-sources.jar /dredit/war/WEB-INF/lib/google-api-client-android2-1.8.0-beta-sources.jar

Could be a red-hearing, but this seems to imply that the Java version of the sample app could be used on Android? 可能是一个红听,但这似乎意味着Java版本的示例应用程序可以在Android上使用?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM