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