Ok. It will be something like this:
// Obtain the Download Manager Service.
String serviceString = Context.DOWNLOAD_SERVICE;
DownloadManager downloadManager;
downloadManager = (DownloadManager)getSystemService(servicestring);
// Create a query for paused downloads.
Query pausedDownloadQuery = new Query();
pausedDownloadQuery.setFilterByStatus(DownloadManager.STATUS_PAUSED);
// Query the Download Manager for paused downloads.
Cursor pausedDownloads = downloadManager.query(pausedDownloadQuery);
// Find the column indexes for the data we require.
int reasonIdx =
pausedDownloads.getColumnIndex(DownloadManager.COLUMN_REASON);
int titleIdx = pausedDownloads.getColumnIndex(DownloadManager.COLUMN_TITLE);
int fileSizeIdx =
pausedDownloads.getColumnIndex(DownloadManager.COLUMN_TOTAL_SIZE_BYTES);
int bytesDLIdx =
pausedDownloads.getColumnIndex(DownloadManager.COLUMN_BYTES_DOWNLOADED_SO_FAR);
// Iterate over the result Cursor.
while (pausedDownloads.moveToNext()) {
// Extract the data we require from the Cursor.
String title = pausedDownloads.getString(titleIdx);
int fileSize = pausedDownloads.getInt(fileSizeIdx);
int bytesDL = pausedDownloads.getInt(bytesDLIdx);
// Translate the pause reason to friendly text.
int reason = pausedDownloads.getInt(reasonIdx);
...
}
*Meier, Reto (2012-04-05). Professional Android 4 Application Development
(Wrox Professional Guides) (Kindle Locations 5761-5779). John Wiley and
Sons. Kindle Edition. *
*
*
*
*
On Friday, September 14, 2012 7:43:46 PM UTC-5, Vinay Kumar wrote:
>
> But AsyncTask doesn't had an option to resume the download from where it
> previously stopped (in case of device restart or network failure)
>
> On Sat, Sep 15, 2012 at 2:58 AM, bob <[email protected]<javascript:>
> > wrote:
>
>> Sounds like a job for an AsyncTask.
>>
>> On Friday, September 14, 2012 4:56:15 AM UTC-5, Vinay Kumar wrote:
>>>
>>> Hi All,
>>>
>>> I was wondering if anybody knew how to update progress Bar in the
>>> application while attempting to download file using download manager for
>>> android?
>>>
>>> Please share your ideas.
>>>
>>> Thank you in advance.
>>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to
>> [email protected]<javascript:>
>> To unsubscribe from this group, send email to
>> [email protected] <javascript:>
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>>
>
>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en