問題描述
Android:在後台上傳/下載文件數量的最佳方式 (Android: best way to upload/download number of files in background)
I have recently developed an iPhone application which involves media (Images, Audio and video) sync. operation with my web server.
I have used ASIHTTPRequest
in my iOS application for simultaneous uploading and downloading and do some work in every request finished and failed methods as ASIHTTPRequest
provides these methods.
‑ (void)requestFinished:(ASIHTTPRequest *)request
‑ (void)requestFailed:(ASIHTTPRequest *)request
Is there any similar library for android. That allow me to upload/download
in queue and update me after every successful or failure of request?
‑‑‑‑‑
參考解法
方法 1:
For downloads part, DownloadManager
can be useful . Alas!, no such thing for uploads (yet). To have IOS like functionality, you'd need to write a custom background service.
方法 2:
In android you can use the Download Manager. Here is sample project or you can use the asynchronous class Please refer the below link
Download a file with Android, and showing the progress in a ProgressDialog
(by Irfan DANISH、S.D.、Priya)