huxq17/Pump

downloading file is stopped, recyclerview freeze when DownloadListActivity is called

Opened this issue · 0 comments

My AndroidManifest:

<activity android:name="com.example.app.DownloadListActivity" />

This is my code because I want to see the file/s that are/is downloading immediately after I start the download:

//start the download
String url = "https://file-examples-com.github.io/uploads/2017/04/file_example_MP4_480_1_5MG.mp4";
Pump.newRequest(url, Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath() + "/Test Downloads")
                .setId(url)
                .setDownloadTaskExecutor(ApplicationClass.getInstance().musicDownloadDispatcher)
                .forceReDownload(true)
                .submit();

//I call this activity immediately because I want to see the progress automatically without having to click the "view download list" button
DownloadListActivity.start(requireActivity(), "");

The problem is that, yes the download list activity is shown but doesn't move or I cant click the pause button or do anything. Also, the download freezes and wont save (i tried to just wait even if the mb progress doesnt move but still the file isnt save, p.s its only 1.5mb and i have a fast wifi)

The only thing that makes the download works is if I don't open the DownloadListActivity at all. I tried to delay to open the DownloadListActivity like below:

Pump.newRequest(url, Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath() + "/Test Downloads")
                .setId(url)
                .setDownloadTaskExecutor(ApplicationClass.getInstance().musicDownloadDispatcher)
                .forceReDownload(true)
                .submit();
        
        Handler handler = new Handler();
        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                DownloadListActivity.start(requireActivity(), "");
            }
        }, 5000);

and boom, the download saves/works (file is only 1.5mb so in the 5 seconds of delay time, the download is already finished)... the problem with this is ofcourse the progress can't be seen live + random videos and file sizes are being downloaded once my app is live, my users are not clairvoyant people so ofcourse its impractical to guess whether to open the DownloadListActivity just because the download is already finished, what's the purpose of view download list with progress shown after all right?

In conclusion, the problem here is the DownloadListActivity. I don't know what's going on, all codes I used is from the default code you've given.

Anyone who can give me an idea of what's going on is very helpful. Thank you in advance!