Question

I am developing an android app which needs to upload files from google drive to remote server. I am able to download the files from the google drive to the device and vice-versa. I am refering this link. But I am not able to upload the file directly to the remote server. Please help.

Thanks & Regards, Sameer.

Was it helpful?

Solution

Google Drive server cannot actively upload file to your server. Your server should have authorized Drive API to download from Google Drive. To rephrase, you can't "upload" from Drive to remote server. You should "download" from Drive to remote server.

To do this, you need to authenticate your Android app to your server just like you do with web application. Then, user select file using Android UI and retrieve fileId of the file you want to download to remote server. Then, you send this fileId to your remote server with, for example, simple HTTP request. Your server will then trigger download of the file from Drive.

To make things more simple, you can download to Android and then upload to your server, but this is apparently waste of network resource which I would want to avoid.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top