Aspsine / MultiThreadDownload

Android Multi-Thread Download library
908 stars 285 forks source link

Finished Download Items Data , Removed From Database #83

Open majidas2006 opened 8 years ago

majidas2006 commented 8 years ago

Hi when a file is downloaded completely and you close app and open again , Fully Downloaded Files are not specifid in the download manager list, only semi downloaded files data can specified why ThredInfo Table gets clear after file download gets finished ? how i can handle that a file is completely downloade and on next opening app install it?

Qamhan commented 7 years ago

hi @majidas2006 ,

you can fix the problem by add this line in DownloadTaskImpl class: updateDB(mThreadInfo);

inside Run like following:

@Override public void run() { Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND); insertIntoDB(mThreadInfo); try { mStatus = DownloadStatus.STATUS_PROGRESS; executeDownload(); synchronized (mOnDownloadListener) { //add the following line in your run function updateDB(mThreadInfo); mStatus = DownloadStatus.STATUS_COMPLETED; mOnDownloadListener.onDownloadCompleted(); } } catch (DownloadException e) { handleDownloadException(e); } }