可以在同一个项目中使用 google drive REST API 和 Android API 吗? [英] It's possible to use google drive REST API and Android API in the same project?

查看:13
本文介绍了可以在同一个项目中使用 google drive REST API 和 Android API 吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用 google drive android API 构建的项目,但我想共享一个上传到我的云的文件,我在这里读到另一个问题,这只是可能使用 REST API.所以我问你,有没有办法在同一个项目中使用这两个 API?

I have a project that was build using the google drive android API, but i want to share a file uploaded to my cloud, and I read in another question here that this is just possible using the REST API. So I ask you, there is a way to work with the both API's in the same project?

谢谢

推荐答案

是的,有可能.只要看看这个'Drive file的生命周期',你就可以想象你的应用在那张图片的顶部(Android 应用程序)和底部的 REST Api(驱动服务).不过有几点需要牢记:

Yes, it is possible. Just looking at the this 'Lifecycle of a Drive file', you can imagine your app on top of that picture (Android App) and the REST Api on the bottom (Drive Service). There is a few points to keep in mind, though:

1/GDAA 的主要标识符 DriveId 仅存在于 GDAA (GooPlaySvcs) 中,不存在于 REST Api 中.您必须检索ResourceId",它是 REST Api 中的主要标识符(请参阅 SO 29030110).

1/ The GDAA's main identifier, the DriveId lives in GDAA (GooPlaySvcs) only and does not exist in the REST Api. You must retrieve 'ResourceId' which is the main identifier in the REST Api (see SO 29030110).

2/只有在 GDAA 提交(上传)文件/文件夹后,才能从 DriveId 中获取 ResourceId(参见 SO 22874657)

2/ ResourceId can be obtained from the DriveId only after GDAA committed (uploaded) the file/folder (see SO 22874657)

3/GDAA 按自己的时间表缓冲"网络请求(系统优化),而 REST Api 让您的应用程序控制等待响应,您会遇到很多时间问题.一般来说,如果你浏览这些 SO 问题,你会发现很多关于这些的喋喋不休问题(虽然很乱).

3/ You will run into a lot of timing issues caused by the fact that GDAA 'buffers' network requests on it's own schedule (system optimized), whereas the REST Api let your app control the waiting for the response. In general, if you scan these SO questions, you'll find a lot of chatter about these issues (it's a mess, though).

我为 GDAAREST api,如果你合并它们可以帮助你(它们中的 MainActivity 几乎相同,并且 CRUD 方法具有相同的签名).

I maintain a minimal CRUD wrappers for both GDAA and the REST api that can help you if you merge them (the MainActivity in both of them is almost identical and the CRUD methods have the same signatures).

祝你好运

这篇关于可以在同一个项目中使用 google drive REST API 和 Android API 吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆