android https downloads,android - Why are https downloads pausing with PAUSED_WAITING_TO_RETRY? - St...

I'm using the DownloadManager service in Android to download files over https URLs, such as https://www.antennahouse.com/XSLsample/pdf/sample-link_1.pdf. The files are not (currently) password protected, in case that makes any difference.

Once I enqueue a download request, the DownloadManager starts the download, but it seems to hang. When I check the status, I get

COLUMN_BYTES_DOWNLOADED_SO_FAR: 0

COLUMN_STATUS: 4

COLUMN_REASON: 1

COLUMN_STATUS 4 is STATUS_PAUSED, "when the download is waiting to retry or resume."

COLUMN_REASON 1 is PAUSED_WAITING_TO_RETRY, "when the download is paused because some network error occurred and the download manager is waiting before retrying the request." But there doesn't seem to be a way to determine what network error occurred. The download never successfully completes.

I've checked the logcat monitor for related warnings and errors, but found nothing.

I've tried this with multiple different servers, both in-house and public, with the same result.

There is no obvious network problem: the Wi-Fi connection is up, and downloads using http:// work just fine: the file is downloaded promptly and appears in the filesystem at the specified destination.

In the case of https downloads, our server logs show that the files are being successfully served from the server's point of view. Testing the same https URLs in a browser on a laptop result in successful download of the files, without any obvious problems or extra negotiations showing up in the developer tools network panel.

My code (summarized):

sManager = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);

DownloadManager.Request req = new DownloadManager.Request(sourceURI);

final Uri destinationUri = Uri.fromFile(destinationFile);

req.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI

| DownloadManager.Request.NETWORK_MOBILE)

.setDestinationUri(destinationUri)

.setMimeType(...);

long id = sManager.enqueue(req);

Summary: An https download started via DownloadManager hangs indefinitely, while the same https download works fine in a browser, and plain http downloads work fine with the same app using DownloadManager. The best clue I have is that PAUSED_WAITING_TO_RETRY indicates "some network error occurred." How can I determine what the network error is?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值