Download Manager returns unsuccessful download on Android 9.0












3















I am using Download Manager to download file from the internet. The download complete successfully in Android 6, 8.1, but not in Android 9.0



DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
request.setDescription("Downloading...");
request.setTitle(nameOfFile);
request.setMimeType("application/pdf");
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS + "/CPG", nameOfFile);
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
manager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
queueId = manager.enqueue(request);









share|improve this question

























  • What is listed as the reason?

    – Rainmaker
    Nov 26 '18 at 3:00











  • Provide more info on error. Some graphics would be more beneficial.

    – Pravin Divraniya
    Nov 28 '18 at 13:51











  • sorry for late reply. I have found the solution through here. stackoverflow.com/questions/51770323/…

    – Ehsan Rosdi
    Nov 28 '18 at 16:04
















3















I am using Download Manager to download file from the internet. The download complete successfully in Android 6, 8.1, but not in Android 9.0



DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
request.setDescription("Downloading...");
request.setTitle(nameOfFile);
request.setMimeType("application/pdf");
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS + "/CPG", nameOfFile);
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
manager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
queueId = manager.enqueue(request);









share|improve this question

























  • What is listed as the reason?

    – Rainmaker
    Nov 26 '18 at 3:00











  • Provide more info on error. Some graphics would be more beneficial.

    – Pravin Divraniya
    Nov 28 '18 at 13:51











  • sorry for late reply. I have found the solution through here. stackoverflow.com/questions/51770323/…

    – Ehsan Rosdi
    Nov 28 '18 at 16:04














3












3








3


1






I am using Download Manager to download file from the internet. The download complete successfully in Android 6, 8.1, but not in Android 9.0



DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
request.setDescription("Downloading...");
request.setTitle(nameOfFile);
request.setMimeType("application/pdf");
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS + "/CPG", nameOfFile);
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
manager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
queueId = manager.enqueue(request);









share|improve this question
















I am using Download Manager to download file from the internet. The download complete successfully in Android 6, 8.1, but not in Android 9.0



DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
request.setDescription("Downloading...");
request.setTitle(nameOfFile);
request.setMimeType("application/pdf");
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS + "/CPG", nameOfFile);
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
manager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
queueId = manager.enqueue(request);






android android-download-manager android-9.0-pie






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 26 '18 at 2:39









lagom

3,142102038




3,142102038










asked Nov 15 '18 at 16:25









Ehsan RosdiEhsan Rosdi

14211




14211













  • What is listed as the reason?

    – Rainmaker
    Nov 26 '18 at 3:00











  • Provide more info on error. Some graphics would be more beneficial.

    – Pravin Divraniya
    Nov 28 '18 at 13:51











  • sorry for late reply. I have found the solution through here. stackoverflow.com/questions/51770323/…

    – Ehsan Rosdi
    Nov 28 '18 at 16:04



















  • What is listed as the reason?

    – Rainmaker
    Nov 26 '18 at 3:00











  • Provide more info on error. Some graphics would be more beneficial.

    – Pravin Divraniya
    Nov 28 '18 at 13:51











  • sorry for late reply. I have found the solution through here. stackoverflow.com/questions/51770323/…

    – Ehsan Rosdi
    Nov 28 '18 at 16:04

















What is listed as the reason?

– Rainmaker
Nov 26 '18 at 3:00





What is listed as the reason?

– Rainmaker
Nov 26 '18 at 3:00













Provide more info on error. Some graphics would be more beneficial.

– Pravin Divraniya
Nov 28 '18 at 13:51





Provide more info on error. Some graphics would be more beneficial.

– Pravin Divraniya
Nov 28 '18 at 13:51













sorry for late reply. I have found the solution through here. stackoverflow.com/questions/51770323/…

– Ehsan Rosdi
Nov 28 '18 at 16:04





sorry for late reply. I have found the solution through here. stackoverflow.com/questions/51770323/…

– Ehsan Rosdi
Nov 28 '18 at 16:04












2 Answers
2






active

oldest

votes


















2





+50









I found the solution through here: How to solve Android P DownloadManager stopping with "Cleartext HTTP traffic to 127.0.0.1 not permitted"?



In short, I just need to do the following:



1.create res/xml/network_security_config.xml, then add



<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true" />
</network-security-config>


2. in manifest file, reference it inside application tag



android:networkSecurityConfig="@xml/network_security_config"


For more info, can read here: https://developer.android.com/training/articles/security-config#CleartextTrafficPermitted






share|improve this answer
























  • I tried this , but it did not help me

    – Quick learner
    Dec 3 '18 at 5:04











  • This does not work for people who are passing the http URL to download manager, will work for making other http calls in the same app. @Quicklearner were you able to solve it?

    – Jalpesh
    Feb 28 at 15:15













  • @Jalpesh look at this question of mine stackoverflow.com/questions/53493077/…

    – Quick learner
    Mar 1 at 4:53











  • Sorry, it Looks similar to the solution mentioned above, Am I missing anything?

    – Jalpesh
    Mar 1 at 8:04











  • This problem recur after sometime. I had to manually clear the cache for download manager to enable the downloading process again

    – Ehsan Rosdi
    Mar 1 at 23:29



















2














This tag worked for me



 android:usesCleartextTraffic="true"


Add this tag to the application



 <application
android:name=".ApplicationClass"
android:allowBackup="true"
android:hardwareAccelerated="false"
android:usesCleartextTraffic="true"





share|improve this answer
























  • Do you have any explanation as to why the tag above works, and not the other one that I use?

    – Ehsan Rosdi
    Dec 3 '18 at 6:40











  • i cant say because it might be device specific issue as well , i tried many solutions but none helped except this tag ..

    – Quick learner
    Dec 3 '18 at 6:47











  • Alright, If you found a general solution, let me know. :D

    – Ehsan Rosdi
    Dec 3 '18 at 6:51











  • sure i will let u know

    – Quick learner
    Dec 3 '18 at 6:51






  • 1





    I used that trick before, but the problem may recur. So you may need to do it again once in a while

    – Ehsan Rosdi
    Dec 3 '18 at 6:53











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53323816%2fdownload-manager-returns-unsuccessful-download-on-android-9-0%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









2





+50









I found the solution through here: How to solve Android P DownloadManager stopping with "Cleartext HTTP traffic to 127.0.0.1 not permitted"?



In short, I just need to do the following:



1.create res/xml/network_security_config.xml, then add



<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true" />
</network-security-config>


2. in manifest file, reference it inside application tag



android:networkSecurityConfig="@xml/network_security_config"


For more info, can read here: https://developer.android.com/training/articles/security-config#CleartextTrafficPermitted






share|improve this answer
























  • I tried this , but it did not help me

    – Quick learner
    Dec 3 '18 at 5:04











  • This does not work for people who are passing the http URL to download manager, will work for making other http calls in the same app. @Quicklearner were you able to solve it?

    – Jalpesh
    Feb 28 at 15:15













  • @Jalpesh look at this question of mine stackoverflow.com/questions/53493077/…

    – Quick learner
    Mar 1 at 4:53











  • Sorry, it Looks similar to the solution mentioned above, Am I missing anything?

    – Jalpesh
    Mar 1 at 8:04











  • This problem recur after sometime. I had to manually clear the cache for download manager to enable the downloading process again

    – Ehsan Rosdi
    Mar 1 at 23:29
















2





+50









I found the solution through here: How to solve Android P DownloadManager stopping with "Cleartext HTTP traffic to 127.0.0.1 not permitted"?



In short, I just need to do the following:



1.create res/xml/network_security_config.xml, then add



<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true" />
</network-security-config>


2. in manifest file, reference it inside application tag



android:networkSecurityConfig="@xml/network_security_config"


For more info, can read here: https://developer.android.com/training/articles/security-config#CleartextTrafficPermitted






share|improve this answer
























  • I tried this , but it did not help me

    – Quick learner
    Dec 3 '18 at 5:04











  • This does not work for people who are passing the http URL to download manager, will work for making other http calls in the same app. @Quicklearner were you able to solve it?

    – Jalpesh
    Feb 28 at 15:15













  • @Jalpesh look at this question of mine stackoverflow.com/questions/53493077/…

    – Quick learner
    Mar 1 at 4:53











  • Sorry, it Looks similar to the solution mentioned above, Am I missing anything?

    – Jalpesh
    Mar 1 at 8:04











  • This problem recur after sometime. I had to manually clear the cache for download manager to enable the downloading process again

    – Ehsan Rosdi
    Mar 1 at 23:29














2





+50







2





+50



2




+50





I found the solution through here: How to solve Android P DownloadManager stopping with "Cleartext HTTP traffic to 127.0.0.1 not permitted"?



In short, I just need to do the following:



1.create res/xml/network_security_config.xml, then add



<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true" />
</network-security-config>


2. in manifest file, reference it inside application tag



android:networkSecurityConfig="@xml/network_security_config"


For more info, can read here: https://developer.android.com/training/articles/security-config#CleartextTrafficPermitted






share|improve this answer













I found the solution through here: How to solve Android P DownloadManager stopping with "Cleartext HTTP traffic to 127.0.0.1 not permitted"?



In short, I just need to do the following:



1.create res/xml/network_security_config.xml, then add



<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true" />
</network-security-config>


2. in manifest file, reference it inside application tag



android:networkSecurityConfig="@xml/network_security_config"


For more info, can read here: https://developer.android.com/training/articles/security-config#CleartextTrafficPermitted







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 28 '18 at 16:03









Ehsan RosdiEhsan Rosdi

14211




14211













  • I tried this , but it did not help me

    – Quick learner
    Dec 3 '18 at 5:04











  • This does not work for people who are passing the http URL to download manager, will work for making other http calls in the same app. @Quicklearner were you able to solve it?

    – Jalpesh
    Feb 28 at 15:15













  • @Jalpesh look at this question of mine stackoverflow.com/questions/53493077/…

    – Quick learner
    Mar 1 at 4:53











  • Sorry, it Looks similar to the solution mentioned above, Am I missing anything?

    – Jalpesh
    Mar 1 at 8:04











  • This problem recur after sometime. I had to manually clear the cache for download manager to enable the downloading process again

    – Ehsan Rosdi
    Mar 1 at 23:29



















  • I tried this , but it did not help me

    – Quick learner
    Dec 3 '18 at 5:04











  • This does not work for people who are passing the http URL to download manager, will work for making other http calls in the same app. @Quicklearner were you able to solve it?

    – Jalpesh
    Feb 28 at 15:15













  • @Jalpesh look at this question of mine stackoverflow.com/questions/53493077/…

    – Quick learner
    Mar 1 at 4:53











  • Sorry, it Looks similar to the solution mentioned above, Am I missing anything?

    – Jalpesh
    Mar 1 at 8:04











  • This problem recur after sometime. I had to manually clear the cache for download manager to enable the downloading process again

    – Ehsan Rosdi
    Mar 1 at 23:29

















I tried this , but it did not help me

– Quick learner
Dec 3 '18 at 5:04





I tried this , but it did not help me

– Quick learner
Dec 3 '18 at 5:04













This does not work for people who are passing the http URL to download manager, will work for making other http calls in the same app. @Quicklearner were you able to solve it?

– Jalpesh
Feb 28 at 15:15







This does not work for people who are passing the http URL to download manager, will work for making other http calls in the same app. @Quicklearner were you able to solve it?

– Jalpesh
Feb 28 at 15:15















@Jalpesh look at this question of mine stackoverflow.com/questions/53493077/…

– Quick learner
Mar 1 at 4:53





@Jalpesh look at this question of mine stackoverflow.com/questions/53493077/…

– Quick learner
Mar 1 at 4:53













Sorry, it Looks similar to the solution mentioned above, Am I missing anything?

– Jalpesh
Mar 1 at 8:04





Sorry, it Looks similar to the solution mentioned above, Am I missing anything?

– Jalpesh
Mar 1 at 8:04













This problem recur after sometime. I had to manually clear the cache for download manager to enable the downloading process again

– Ehsan Rosdi
Mar 1 at 23:29





This problem recur after sometime. I had to manually clear the cache for download manager to enable the downloading process again

– Ehsan Rosdi
Mar 1 at 23:29













2














This tag worked for me



 android:usesCleartextTraffic="true"


Add this tag to the application



 <application
android:name=".ApplicationClass"
android:allowBackup="true"
android:hardwareAccelerated="false"
android:usesCleartextTraffic="true"





share|improve this answer
























  • Do you have any explanation as to why the tag above works, and not the other one that I use?

    – Ehsan Rosdi
    Dec 3 '18 at 6:40











  • i cant say because it might be device specific issue as well , i tried many solutions but none helped except this tag ..

    – Quick learner
    Dec 3 '18 at 6:47











  • Alright, If you found a general solution, let me know. :D

    – Ehsan Rosdi
    Dec 3 '18 at 6:51











  • sure i will let u know

    – Quick learner
    Dec 3 '18 at 6:51






  • 1





    I used that trick before, but the problem may recur. So you may need to do it again once in a while

    – Ehsan Rosdi
    Dec 3 '18 at 6:53
















2














This tag worked for me



 android:usesCleartextTraffic="true"


Add this tag to the application



 <application
android:name=".ApplicationClass"
android:allowBackup="true"
android:hardwareAccelerated="false"
android:usesCleartextTraffic="true"





share|improve this answer
























  • Do you have any explanation as to why the tag above works, and not the other one that I use?

    – Ehsan Rosdi
    Dec 3 '18 at 6:40











  • i cant say because it might be device specific issue as well , i tried many solutions but none helped except this tag ..

    – Quick learner
    Dec 3 '18 at 6:47











  • Alright, If you found a general solution, let me know. :D

    – Ehsan Rosdi
    Dec 3 '18 at 6:51











  • sure i will let u know

    – Quick learner
    Dec 3 '18 at 6:51






  • 1





    I used that trick before, but the problem may recur. So you may need to do it again once in a while

    – Ehsan Rosdi
    Dec 3 '18 at 6:53














2












2








2







This tag worked for me



 android:usesCleartextTraffic="true"


Add this tag to the application



 <application
android:name=".ApplicationClass"
android:allowBackup="true"
android:hardwareAccelerated="false"
android:usesCleartextTraffic="true"





share|improve this answer













This tag worked for me



 android:usesCleartextTraffic="true"


Add this tag to the application



 <application
android:name=".ApplicationClass"
android:allowBackup="true"
android:hardwareAccelerated="false"
android:usesCleartextTraffic="true"






share|improve this answer












share|improve this answer



share|improve this answer










answered Dec 3 '18 at 5:06









Quick learnerQuick learner

2,6251926




2,6251926













  • Do you have any explanation as to why the tag above works, and not the other one that I use?

    – Ehsan Rosdi
    Dec 3 '18 at 6:40











  • i cant say because it might be device specific issue as well , i tried many solutions but none helped except this tag ..

    – Quick learner
    Dec 3 '18 at 6:47











  • Alright, If you found a general solution, let me know. :D

    – Ehsan Rosdi
    Dec 3 '18 at 6:51











  • sure i will let u know

    – Quick learner
    Dec 3 '18 at 6:51






  • 1





    I used that trick before, but the problem may recur. So you may need to do it again once in a while

    – Ehsan Rosdi
    Dec 3 '18 at 6:53



















  • Do you have any explanation as to why the tag above works, and not the other one that I use?

    – Ehsan Rosdi
    Dec 3 '18 at 6:40











  • i cant say because it might be device specific issue as well , i tried many solutions but none helped except this tag ..

    – Quick learner
    Dec 3 '18 at 6:47











  • Alright, If you found a general solution, let me know. :D

    – Ehsan Rosdi
    Dec 3 '18 at 6:51











  • sure i will let u know

    – Quick learner
    Dec 3 '18 at 6:51






  • 1





    I used that trick before, but the problem may recur. So you may need to do it again once in a while

    – Ehsan Rosdi
    Dec 3 '18 at 6:53

















Do you have any explanation as to why the tag above works, and not the other one that I use?

– Ehsan Rosdi
Dec 3 '18 at 6:40





Do you have any explanation as to why the tag above works, and not the other one that I use?

– Ehsan Rosdi
Dec 3 '18 at 6:40













i cant say because it might be device specific issue as well , i tried many solutions but none helped except this tag ..

– Quick learner
Dec 3 '18 at 6:47





i cant say because it might be device specific issue as well , i tried many solutions but none helped except this tag ..

– Quick learner
Dec 3 '18 at 6:47













Alright, If you found a general solution, let me know. :D

– Ehsan Rosdi
Dec 3 '18 at 6:51





Alright, If you found a general solution, let me know. :D

– Ehsan Rosdi
Dec 3 '18 at 6:51













sure i will let u know

– Quick learner
Dec 3 '18 at 6:51





sure i will let u know

– Quick learner
Dec 3 '18 at 6:51




1




1





I used that trick before, but the problem may recur. So you may need to do it again once in a while

– Ehsan Rosdi
Dec 3 '18 at 6:53





I used that trick before, but the problem may recur. So you may need to do it again once in a while

– Ehsan Rosdi
Dec 3 '18 at 6:53


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53323816%2fdownload-manager-returns-unsuccessful-download-on-android-9-0%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Bressuire

Vorschmack

Quarantine