Ani
Ani

Reputation: 1061

Android DownloadManager using for ByteStream

Can we use DownloadManager to download the bytestream. I have to download a PDF bill which is a bytestream and after download, I want to create a file. I can do it with a file but not with bytestream. has anyone does that?

Upvotes: 0

Views: 250

Answers (1)

Ginni
Ginni

Reputation: 146

You cannot read the bytestream but once the file is downloaded by DownloadManager, it would be saved in Downloads directory or application's private directory. You can create a broadcast receiver which takes following intent action.

 DownloadManager.ACTION_DOWNLOAD_COMPLETE

In Broadcast receiver, you can read the downloaded file from directory. You have query in downloads db with last download id. After getting downloaded file URI, you can read the file through bytestream.

Upvotes: 1

Related Questions