简体   繁体   English

如何使用 Java 在 android 中使用 http 请求下载公共 Google 驱动器文件?

[英]How to download public Google drive file using http request in android using Java?

I have tried so many ways to download google drive public file but unable to find any answer?我尝试了很多方法来下载谷歌驱动器公共文件但找不到任何答案? If anyone knows how to do that please help me.如果有人知道该怎么做,请帮助我。

Note: without using Google drive api注意:不使用谷歌驱动 api

Most files (docs, sheets, presentation, etc..) can be downloaded by replacing edit with export?format= in the URL.大多数文件(文档、表格、演示文稿等)都可以通过将 URL 中的edit替换为export?format=来下载。

https://docs.google.com/document/d/FILE-ID/edit
https://docs.google.com/document/d/FILE-ID/export?format=doc

There are a lot of formats available (pdf/doc/pptx/xlsx/csv/jpg/etc...)有很多可用的格式(pdf/doc/pptx/xlsx/csv/jpg/etc...)

The above solution usually works fine with pdfs, images, native google files and microsoft office files.上述解决方案通常适用于 pdf、图像、本地 google 文件和 microsoft office 文件。 However, if you are trying to download another type of file, you can use the next URL.但是,如果您尝试下载其他类型的文件,则可以使用下一个 URL。

https://drive.google.com/uc?export=download&id=FILE-ID

More URL tricks here 更多 URL 技巧在这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM