我想使用默认的下载管理器来获取本地网络上提供的文件。我的代码如下:
Uri file = new Uri("http://<server_local_ip>/<path_to_file>");
DownloadManager.Request request = new DownloadManager.Request(file);
request.setTitle(...);
//request... other download notification settings
downloadManager = (DownloadManager)getSystemService(Context.DOWNLOAD_SERVICE);
long ticket = downloadManager.enqueue(request);
问题在于下载从未开始,它保持DownloadManager.STATUS_PAUSED
状态,并在原因列DownloadManager.PAUSED_WAITING_FOR_NETWORK
中,但是我可以使用浏览器下载文件。
我想念什么?这可能吗?