flutter_downloader icon indicating copy to clipboard operation
flutter_downloader copied to clipboard

Download automatic cancelled after ten minutes of waiting and restart again

Open georgeprosperr opened this issue 5 years ago • 7 comments

Am facing problem with this package.

I tried to download large file that takes more than ten minutes. After ten minutes exactly application cancel the download process and restart again.

georgeprosperr avatar Apr 02 '20 20:04 georgeprosperr

D/ViewRootImpl@c13dc45MainActivity: MSG_WINDOW_FOCUS_CHANGED 0 1 D/InputMethodManager(18437): prepareNavigationBarInfo() DecorView@db6a42[MainActivity] D/InputMethodManager(18437): getNavigationBarColor() 520093696 D/ConnectivityManager(18437): unregisterNetworkCallback; CallingUid : 10240, CallingPid : 18437 I/WM-WorkerWrapper(18437): Work [ id=dc29c7c0-9d1d-4096-a9ac-47abd21cdcd1, tags={ flutter_download_task, vn.hunghd.flutterdownloader.DownloadWorker } ] was cancelled I/WM-WorkerWrapper(18437): java.util.concurrent.CancellationException: Task was cancelled. I/WM-WorkerWrapper(18437): at androidx.work.impl.utils.futures.AbstractFuture.cancellationExceptionWithCause(AbstractFuture.java:1184) I/WM-WorkerWrapper(18437): at androidx.work.impl.utils.futures.AbstractFuture.getDoneValue(AbstractFuture.java:514) I/WM-WorkerWrapper(18437): at androidx.work.impl.utils.futures.AbstractFuture.get(AbstractFuture.java:475) I/WM-WorkerWrapper(18437): at androidx.work.impl.WorkerWrapper$2.run(WorkerWrapper.java:284) I/WM-WorkerWrapper(18437): at androidx.work.impl.utils.SerialExecutor$Task.run(SerialExecutor.java:91) I/WM-WorkerWrapper(18437): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) I/WM-WorkerWrapper(18437): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) I/WM-WorkerWrapper(18437): at java.lang.Thread.run(Thread.java:764) D/skia (18437): --- Failed to create image decoder with message 'unimplemented' D/DownloadWorker(18437): Download canceled I/flutter (18437): Background Isolate Callback: task (dc29c7c0-9d1d-4096-a9ac-47abd21cdcd1) is in status (DownloadTaskStatus(5)) and process (100) I/flutter (18437): UI Isolate Callback: [dc29c7c0-9d1d-4096-a9ac-47abd21cdcd1, DownloadTaskStatus(5), 100] I/flutter (18437): 100 I/flutter (18437): task.thumbnail I/flutter (18437): /storage/emulated/0/Android/data/com.example.reelflex/files/Thumbnails/2020-04-01T20:30:15.437281Z.png I/flutter (18437): Task to JSON I/flutter (18437): {name: The Chronicles Of Cisco: Entry 0419 - Part 1, link: http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4, thumbnail: /storage/emulated/0/Android/data/com.example.reelflex/files/Thumbnails/2020-04-01T20:30:15.437281Z.png} I/flutter (18437): DownloadTaskStatus(5) E/AccessibilityBridge(18437): VirtualView node must not be the root node. D/ViewRootImpl@c13dc45MainActivity: MSG_WINDOW_FOCUS_CHANGED 1 1 D/InputMethodManager(18437): prepareNavigationBarInfo() DecorView@db6a42[MainActivity] D/InputMethodManager(18437): getNavigationBarColor() 520093696 D/DownloadWorker(18437): DownloadWorker{url=http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4,filename=test.mp4,savedDir=/storage/emulated/0/Android/data/com.example.reelflex/files/Download,header={"auth": "test_for_sql_encoding"},isResume=true D/skia (18437): --- Failed to create image decoder with message 'unimplemented' I/flutter (18437): Background Isolate Callback: task (dc29c7c0-9d1d-4096-a9ac-47abd21cdcd1) is in status (DownloadTaskStatus(2)) and process (100) I/flutter (18437): UI Isolate Callback: [dc29c7c0-9d1d-4096-a9ac-47abd21cdcd1, DownloadTaskStatus(2), 100] D/DownloadWorker(18437): Open connection to http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4 D/DownloadWorker(18437): Headers = {"auth": "test_for_sql_encoding"} I/flutter (18437): 100 I/flutter (18437): task.thumbnail I/flutter (18437): /storage/emulated/0/Android/data/com.example.reelflex/files/Thumbnails/2020-04-01T20:30:15.437281Z.png I/flutter (18437): Task to JSON I/flutter (18437): {name: The Chronicles Of Cisco: Entry 0419 - Part 1, link: http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4, thumbnail: /storage/emulated/0/Android/data/com.example.reelflex/files/Thumbnails/2020-04-01T20:30:15.437281Z.png} D/DownloadWorker(18437): Resume download: Range: bytes=0- I/flutter (18437): DownloadTaskStatus(2)

georgeprosperr avatar Apr 02 '20 20:04 georgeprosperr

This is a limitation of the underlying WorkManager (e.g. see https://stackoverflow.com/a/53734222/4857310), at least when not used in foreground mode (see https://developer.android.com/topic/libraries/architecture/workmanager/advanced/long-running). The library will only execute tasks for a maximum of 10 minutes. If this is exceeded, the task is stopped and might be resumed again in the future.

This should be no problem if your download server supports range requests so that the download continues from where it was aborted before.

flutter_downloader could be updated to add support for WorkManager's long running tasks and provide a way to customize the shown notification (which is then required).

nioncode avatar Apr 06 '20 08:04 nioncode

I forked and update this package to extend time limit now its working just fine. Am not sure if its perfect way but its worked. Please try to review. I think it could be helpful to other that are facing the same problem. https://github.com/georgeprosperr/flutter_downloader Thanks once again.

georgeprosperr avatar Apr 06 '20 09:04 georgeprosperr

Ha

I forked and update this package to extend time limit now its working just fine. Am not sure if its perfect way but its worked. Please try to review. I think it could be helpful to other that are facing the same problem. https://github.com/georgeprosperr/flutter_downloader Thanks once again.

I'm also facing that 10 minutes stop problem, it is happening any circumstances like even I'm using my phone when downloading, I give autostart permission and no battery restruction, it is stop.

What I know on android is the workmanager should not be stop, if we give no battery restruction permission.

What u changed to support more than 10 minutes bro? If u don't mind please update ur forked, coz ur version has been too old.

shinewanna avatar Feb 16 '22 15:02 shinewanna

Let me check. Time passed since I do this.

On Wed, 16 Feb 2022, 18:45 Shine Wanna, @.***> wrote:

Ha

I forked and update this package to extend time limit now its working just fine. Am not sure if its perfect way but its worked. Please try to review. I think it could be helpful to other that are facing the same problem. https://github.com/georgeprosperr/flutter_downloader Thanks once again.

I'm also facing that 10 minutes stop problem, it is happening any circumstances like even I'm using my phone when downloading, I give autostart permission and no battery restruction, it is stop.

What I know on android is the workmanager should not be stop, if we give no battery restruction permission.

What u changed to support more than 5 minutes bro? If u don't mind please update ur forked, coz ur version has been too old.

— Reply to this email directly, view it on GitHub https://github.com/fluttercommunity/flutter_downloader/issues/275#issuecomment-1041773772, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKEYD374ZNMWB2VHX3HUOJ3U3PA73ANCNFSM4L24AGQA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

georgeprosperr avatar Feb 16 '22 16:02 georgeprosperr

@georgeprosperr Hay bro, is there any updates?

shinewanna avatar Feb 19 '22 04:02 shinewanna

Hi, any updates on this? still auto cancelled after 9 minutes.

raywoocn avatar Dec 25 '23 05:12 raywoocn