问题
I would like to know at what point DownloadManager
is ready to download. I am testing my app on Android 6, and found that downloads are not starting for a very long time until they eventually do. Such delay did not happen on Android 4 KitKat.
I know they are not starting because when I query them using DownloadManager.COLUMN_TOTAL_SIZE_BYTES
, they continually return -1 for some minutes, and then suddenly the download starts.
I am using DownloadManager#enqueue
, and the doc says:
Enqueue a new download. The download will start automatically once the download manager is ready to execute it and connectivity is available.
My connectivity is fine. I tested on different devices and on different networks but it did not help.
When is download manager deemed "ready to execute?" Any suggestions on why my downloads are not starting for some extended period of time?
Update
I discovered that the status of the download is stuck at STATUS_PAUSED
rather than STATUS_PENDING
. For the reason, I get PAUSED_WAITING_TO_RETRY
. The doc says that this means:
when the download is paused because some network error occurred and the download manager is waiting before retrying the request.
But I don't have any network problem. Why does this only happen on Android 6?
来源:https://stackoverflow.com/questions/33882393/when-is-downloadmanager-ready-to-begin-downloading