Marcel
Marcel

Reputation: 110

Android Java download manager no longer works

My code don't work anymore, because the Download manager don't accept the download link, but last Week the Download manager accept the link. Can someone helps me? I think Google change something... Thanks

change the link to someone other url(works)

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);

Upvotes: 0

Views: 70

Answers (1)

Kumar Kumar
Kumar Kumar

Reputation: 26

From Android 9.0 Its Changing You should use

        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);

Upvotes: 1

Related Questions