【问题标题】:Android - DownloadManager: "Missing request for path"Android - DownloadManager:“缺少路径请求”
【发布时间】:2016-12-06 20:46:52
【问题描述】:

我正在创建一个像这样的 DownloadManager.Request:

  DownloadManager.Request request = new DownloadManager.Request(url);
  request.setDescription(fileName);
  request.setTitle("Title");

  request.setDestinationInExternalPublicDir(sourceDir, fileName);

  downloadManager.enqueue(request);

但我正在登录此警告: Missing request for path [path]

你知道这意味着什么吗?我该如何解决?

【问题讨论】:

    标签: android android-download-manager download-manager


    【解决方案1】:

    Android source repository中有代码

    @Override
    public void onScanCompleted(String path, Uri uri) {
        final ScanRequest req;
        synchronized (mConnection) {
            req = mPending.remove(path);
        }
        if (req == null) {
            Log.w(TAG, "Missing request for path " + path);
            return;
        }
    ...
    

    它在下载完成时开始,并从待处理的下载列表中删除请求。由于某种原因,目前没有正确的参考。

    在我的实现中我没有发现由于这个问题导致的任何错误,因为在这条消息之后我总是收到Finished with status SUCCESS

    更新: 我发现这条消息是由 DownloadManager.Request 类的方法产生的:request.allowScanningByMediaScanner(); 这可能有问题。

    【讨论】:

      猜你喜欢
      • 2020-08-02
      • 1970-01-01
      • 2019-02-02
      • 1970-01-01
      • 2017-03-15
      • 2019-07-06
      • 1970-01-01
      • 2018-04-25
      • 2021-07-12
      相关资源
      最近更新 更多