简体   繁体   English

如何通过网站URL而不是文件URL下载文件

[英]How to download a file by web site URL and not file URL

I want to create an Android app that will download my own locations file from Google Location History and will display my locations at a certain date. 我想创建一个Android应用,该应用将从Google位置记录中下载我自己的位置文件,并在特定日期显示我的位置。

I know how to write an AsyncTask that downloads a file by the file url BUT I don't know how to write an AsyncTask to download a file by a URL to a web site? 我知道如何编写通过文件url下载文件的AsyncTask ,但我不知道如何通过URL将文件下载到网址的AsyncTask吗?

Whenever I navigate to the following url(to a site not to a specific file): [ https://www.google.com/maps/timeline/kml?authuser=0&pb=!1m8!1m3!1i2015!2i8!3i1!2m3!1i2015!2i8!3i1][1] a kml file with my locations on 2015-09-01 is being downloaded automatically. 每当我导航到以下网址(不是特定文件的网站)时:[ https://www.google.com/maps/timeline/kml?authuser=0&pb=!1m8!1m3!1i2015!2i8!3i1! 2m3!1i2015!2i8!3i1] [1]我的位置为2015-09-01的kml文件会自动下载。 I would like to "catch" this download and display a progressbar starting when the download starts and ending when it ends and have the file content accessible for further processing. 我想“捕获”此下载并在下载开始时显示progressbar ,并在下载结束时显示progressbar ,并且可以访问文件内容以进行进一步处理。

Thanks in Advance. 提前致谢。

There's no difference. 没有区别 Just use that same URL as if it pointed to a file. 只需使用与指向文件相同的URL。 Is all the same for HTTP. 对于HTTP来说都是一样的。

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

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