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

♀尐吖头ヾ 提交于 2019-11-28 14:27:20
seanpj

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

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