我的代码不再起作用,因为下载管理器不接受下载链接,但是上周下载管理器接受了该链接。有人可以帮我吗?我认为Google有所改变...谢谢
将链接更改为其他网址(有效)
DownloadManager.Request request = new DownloadManager.Request(Uri.parse("http://suggestqueries.google.com/complete/search?client=firefox&q=" + searchTo.getText().toString()));
request.setDestinationInExternalPublicDir("/open_serach_data/cache", "suggest.txt");
DownloadManager downloadManager = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
downloadManager.enqueue(request);
从Android 9.0开始,您应该使用的更改
DownloadManager.Request request = new DownloadManager.Request(Uri.parse( url ));
request.setDescription(title);
request.setTitle(title);
request.setDestinationUri(Uri.fromFile(f));
img_d_id = manager.enqueue(request);