Hi all, I've worked with Google Drive Api in Android for a week, I used both Android Drive SDK and Drive Rest Api for java but I can't find the way how to how to get the direct download link of a file (anyone can read) on Drive. I've try How to get the url of a file of google drive to download in android but it's not work. Please help me. Thanks.
Given that you have the actual FILE-ID for the file , you can download it using the download link
drive.google.com/uc?id=FILE-ID&export=download
If you want to have the direct download link of a file, DriveFile
doesn't seem to be what you're looking for. What you can do is to use the Drive API web service instead. Note that you're still required to be authenticated for you to use the API.
Check out the Download Files section of the documentation, there are 3 ways for you to download the file.
- Download a file — files.get with alt=media file resource
- Download and export a Google Doc — files.export
- Link a user to a file — webContentLink from the file resource
Another alternative is for you to use the webContentLink
for you to download the file. However, this is only available for files with binary content in Drive.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With