It's possible to use google drive REST API and Android API in the same project?

混江龙づ霸主 提交于 2019-11-27 08:34:46

问题


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?

thanks


回答1:


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/ 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/ ResourceId can be obtained from the DriveId only after GDAA committed (uploaded) the file/folder (see SO 22874657)

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).

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).

Good Luck



来源:https://stackoverflow.com/questions/33425362/its-possible-to-use-google-drive-rest-api-and-android-api-in-the-same-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!