Question

I am developing application having listview with button in each item of listview. I want to add new download in queue onclick of button (like google play). I am using DownloadManager class it is working fine when i click only one button, but when i click second button second download does not get start.

DownloadManager mgr=(DownloadManager)getActivity().getSystemService(Context.DOWNLOAD_SERVICE);mgr.enqueue(new DownloadManager.Request(uri)
                    .setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI |
                            DownloadManager.Request.NETWORK_MOBILE)
                    .setAllowedOverRoaming(false)
                    .setTitle("Download")
                    .setDescription("Application is downloading")
                    .setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS,
                            "test.mp4"));   

What should I do to achieve same. Thanks in advance.

Was it helpful?

Solution

I have tested multiple downloads and it does work. Your destination file is "test.mp4". Are you downloading the multiple files on top of each other?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top