Android Download Manager "download Unsuccessful"
This is my first time trying to implement DownloadManager and no matter what I try, I always get a notification saying 'Download unsuccessful.' I've looked at many other SO forums,
Solution 1:
This issue occur due to network security. If You are using un-secure url in above pie API, then it can't execute your url. Check Official Documentation.
Reason for avoiding cleartext traffic is the lack of confidentiality, authenticity, and protections against tampering; a network attacker can eavesdrop on transmitted data and also modify it without being detected.
Add following in manifest to bypass all security.
<applicationandroid:name=".ApplicationClass"....android:usesCleartextTraffic="true">
Solution 2:
My Experience on 1/11/2021, min SDK 19, Target SDK 30
I spent a day on using Download Service and finally it worked. To sum it up for anyone who wants to try for the first time:
- Dont't forget to add WRITE_EXTERNAL_STORAGE and INTERNET permissions in Manifest.
- use requestPermissions() to grant permission from user.
- use getExternalFilesDir() instead of getExternalStorageDirectory().
- If you're downloading from http:// so add usesCleartextTraffic="true" to manifest.
Post a Comment for "Android Download Manager "download Unsuccessful""