DownloadManager requests delayed on Android Pie

后端 未结 1 1103
你的背包
你的背包 2021-01-05 01:04

I have been using the DownloadManager APIs to handle downloads in one app for about 3 years. Recently I had some users on Android Pie complaining that sometimes downloads ge

相关标签:
1条回答
  • 2021-01-05 02:02

    As mentioned in the comments above, clearing the Download manager cache and data resolves this problem on Android 9 Pie. To clear these settings, you need to go to Apps & notifications, click the option to See all apps, tap the options menu in the upper-right corner, select Show system, select Download Manager from the list, tap on Storage, then clear the cache and storage.

    When troubleshooting this problem I discovered that when trying to use DownloadManager to download a file to a public directory, the following warning was written to the log if a public download location was used:

    DownloadManager: Path appears to be invalid: /storage/emulated/0/Download/File Name
    

    This error appears irrespective of whether the app has the storage permission. However, it appears to be a false warning that is logged by isFilenameValidInExternalPackage() (source code) when checking if the file is outside an app directory and is run even if the app has the storage permission. As such, this false warning continues to appear even after clearing DownloadManager's cache and storage, although the download works anyway.

    Edit: this problem appears to recur periodically. Typically, force stopping Download Manager resolves it temporarily. Hopefully Google releases a permanent fix.

    0 讨论(0)
提交回复
热议问题