okdownload icon indicating copy to clipboard operation
okdownload copied to clipboard

关于断网后,重新恢复网络没有恢复下载的问题。

Open OpenfaceSY opened this issue 4 years ago • 0 comments

版本为: implementation 'com.liulishuo.okdownload:okdownload:1.0.7' implementation 'com.liulishuo.okdownload:sqlite:1.0.7' implementation 'com.liulishuo.okdownload:okhttp:1.0.7' implementation 'com.liulishuo.okdownload:filedownloader:1.0.7' implementation 'com.squareup.okhttp3:okhttp:3.10.0'

操作步骤:1)点击下载,fetchProgress会返回进度; 2)断掉网络,或关闭WiFi后,接收到系统网络变化广播,然后手动调用queueSet?.resume()或OkDownload.with().downloadDispatcher().enqueue(task)方法; 3)等待网络连接成功后,接收到系统网络连接成功广播,然后手动调用queueSet?.resume()或OkDownload.with().downloadDispatcher().enqueue(task)方法;

此时可以接收到taskStart、taskEnd方法的回调,但taskEnd方法中EndCause参数为ERROR,系统log会报警告 2020-07-24 15:11:05.354 12865-12865/xxx W/System.err: java.net.UnknownHostException: network is not available! 2020-07-24 15:11:05.354 12865-12865/xxx W/System.err: at com.liulishuo.okdownload.core.download.DownloadStrategy.inspectNetworkAvailable(DownloadStrategy.java:373) 2020-07-24 15:11:05.355 12865-12865/xxx W/System.err: at com.liulishuo.okdownload.core.download.ConnectTrial.executeTrial(ConnectTrial.java:73) 2020-07-24 15:11:05.355 12865-12865/xxx W/System.err: at com.liulishuo.okdownload.core.download.BreakpointRemoteCheck.check(BreakpointRemoteCheck.java:100) 2020-07-24 15:11:05.355 12865-12865/xxx W/System.err: at com.liulishuo.okdownload.core.download.DownloadCall.execute(DownloadCall.java:180) 2020-07-24 15:11:05.355 12865-12865/xxx W/System.err: at com.liulishuo.okdownload.core.NamedRunnable.run(NamedRunnable.java:32) 2020-07-24 15:11:05.355 12865-12865/xxx W/System.err: at com.liulishuo.okdownload.core.dispatcher.DownloadDispatcher.syncRunCall(DownloadDispatcher.java:369) 2020-07-24 15:11:05.355 12865-12865/xxx W/System.err: at com.liulishuo.okdownload.core.dispatcher.DownloadDispatcher.execute(DownloadDispatcher.java:183) 2020-07-24 15:11:05.355 12865-12865/xxx W/System.err: at com.liulishuo.okdownload.DownloadTask.execute(DownloadTask.java:535) 2020-07-24 15:11:05.355 12865-12865/xxx W/System.err: at com.liulishuo.okdownload.DownloadSerialQueue.run(DownloadSerialQueue.java:180) 2020-07-24 15:11:05.355 12865-12865/xxx W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 2020-07-24 15:11:05.355 12865-12865/xxx W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 2020-07-24 15:11:05.355 12865-12865/xxx W/System.err: at java.lang.Thread.run(Thread.java:919)

求解决方法

OpenfaceSY avatar Jul 24 '20 07:07 OpenfaceSY