try {
String url = "MY URL"
i = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
view.openDownloadIntent(i); // startsActivity
}
catch (NullPointerException e) {
view.showMissingDocumentMessage("Failed");
}
This obviously opens a browser with the URL and goes immedtiatly to a downloading task. It works, but it's interruptive and should happen in the background.
Is there another way to do this?
You can use simply
DownloadManager
for this task,For example,
And you also have to add
WRITE_EXTERNAL_STORAGE
permission in yourAndroidManifest
file that is,