Multitask、MultiThread(MultiConnection)、Breakpoint-resume、High-concurrency、Simple to use、Single/NotSingle-process

Overview

FileDownloader

Android multi-task file download engine.

Download Build Status

中文文档

FileDownloader2

Now, FileDownloader2-OkDownload is released, okdownload will contain all advantage on the FileDownloader and beyond.

Because of FileDownloader unit-test coverage is very low, so all farther features and enhances will be achieved on the okdownload instead of FileDownloader, and FileDownloader will only focuses on bug fixes.

DEMO

Installation

FileDownloader is installed by adding the following dependency to your build.gradle file:

dependencies {
    implementation 'com.liulishuo.filedownloader:library:1.7.7'
}

Snapshots of the development version are available in Sonatype's snapshots repository, you can include on your gradle project through:

repositories {
    maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}

Open customize component

From now on, FileDownloader support following components to be customized by yourself:

Name Interface Default Impl
Connection FileDownloadConnection FileDownloadUrlConnection
OutputStream FileDownloadOutputStream FileDownloadRandomAccessFile
Database FileDownloadDatabase RemitDatabase
ConnectionCountAdapter ConnectionCountAdapter DefaultConnectionCountAdapter
IdGenerator IdGenerator DefaultIdGenerator
ForegroundServiceConfig ForegroundServiceConfig ForegroundServiceConfig
  • If you want to use okhttp as your connection component, the simplest way is this repo.
  • If you don't want to use any database on FileDownloader(the database on FileDownloader is used for persist tasks' breakpoint info) just using NoDatabaseImpl.java

How to valid it?

Just create your own DownloadMgrInitialParams.InitCustomMaker and put those customized component to it, finally init the FileDownloader with it: FileDownloader#init

Adaptation

Adapt to Android 8.0

The restriction of background service has been tightened since Android 8.0, for more details, please refer to here. So, after Android 8.0, the download service will be a foreground service when start downloading during app is in background and you will see a notification with a title named "FileDownloader" start from FileDownloader 1.7.6. You can refer to here to custom the notification.

Adapt to Android 9.0

Starting with Android 9.0 (API level 28), cleartext support is disabled by default, you can have a look at here to know about more details. FileDownloader demo has handled this problem start with 1.7.6.

According to the migration notes, the FOREGROUND_SERVICE permission has been added to the library manifest since FileDownloader 1.7.6.

Welcome PR

If you can improve the unit test for this project would be great.

Usage

By default, the FileDownloadService runs on the separate process, if you want to run it on the main process, just configure on the filedownloader.properties, and you can use FileDownloadUtils.isDownloaderProcess(Context) to check whether the FileDownloadService can run on the current process.

For more readable, Moved to Wiki.

LICENSE

Copyright (c) 2015 LingoChamp Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Comments
  • 下载到最后回调两次99%但是接下来的任何进度

    下载到最后回调两次99%但是接下来的任何进度

    @Gongcong @wanghaihui

    多次返回的总进度相同这个是有可能的

    因为回调是根据是否字节数有增加,而非整体的进度百分比,而具体配置体现在根据间隔/回调进度等配置进行回调

    但是根据你们( @Gongcong @wanghaihui ) 的描述:

    因为我们现在用的就是最新的1.5.7版本,这个问题的复现情况是这样的,下载完后,然后再清除APP缓存数据,然后再下载,会有几率复现,我们打了log,progress是100,但是最后会出现两次progress=99, 然后,完全进度就死在那了,没有任何回调

    似乎是怀疑下载完成了,但是没有回调完成对吗?

    如果是,可以告知下当遇到这种特征情况时(如你们所说在第二次progress=99时):

    1. FileDownloader.getStatus(id, path)返回的状态如何?
    2. 本地的FileDownloadUtils.getTempPath(task.getTargetFilePath())文件是否存在?
    3. 本地的 task.getTargetFilePath()文件是否存在。
    4. 留意Logcat中是否有crash日志,或者warn/error的日志

    P.S. 按照现有代码逻辑是不可能出现下载完成但不回调完成的。只有可能下载进程Crash?或者error的回调,因此我比较倾向于是否是下载进程Crash或者是网络情况导致

    bug 
    opened by Jacksgong 50
  • Access denied to download in sd card

    Access denied to download in sd card

    In Android 5.0 and greater, if I try to download any file in external sd card, I get a IOException: access denied: "open failed: EACCES (Permission denied)". The download path is set to /storage/sdcard1/my_file.xml

    enhancement question 
    opened by victordigio 49
  • APP在后台下载失败的问题,日志如下

    APP在后台下载失败的问题,日志如下

    这是我初始化代码: FileDownloader.setupOnApplicationOnCreate(application) .connectionCreator(OkHttp3Connection.Creator(OkHttpClient.Builder().apply { connectTimeout(20, TimeUnit.SECONDS) readTimeout(20, TimeUnit.SECONDS) }))

    日志如下 一直SocketTimeoutException连接超时(GameDetailActivity 是我打的日志TAG): 2019-08-14 09:19:59.626 28687-28687/com.shanling.mwzs.debug E/GameDetailActivity: progress 2019-08-14 09:20:01.781 28687-28687/com.shanling.mwzs.debug E/GameDetailActivity: progress 2019-08-14 09:20:01.832 28687-28687/com.shanling.mwzs.debug E/GameDetailActivity: progress 2019-08-14 09:20:04.024 28687-28687/com.shanling.mwzs.debug E/GameDetailActivity: progress 2019-08-14 09:20:07.514 28687-28687/com.shanling.mwzs.debug E/GameDetailActivity: progress 2019-08-14 09:20:09.865 28687-28687/com.shanling.mwzs.debug E/GameDetailActivity: progress 2019-08-14 09:20:22.091 28687-28687/com.shanling.mwzs.debug E/GameDetailActivity: error:java.net.SocketException:Software caused connection abort 2019-08-14 09:20:22.204 28687-28687/com.shanling.mwzs.debug E/GameDetailActivity: pending,connected 2019-08-14 09:20:42.424 28687-28687/com.shanling.mwzs.debug E/GameDetailActivity: error:java.net.SocketTimeoutException:failed to connect to apkdown.mowan123.com/59.57.13.140 (port 80) from /192.168.1.114 (port 51560) after 20000ms 2019-08-14 09:20:42.477 28687-28687/com.shanling.mwzs.debug E/GameDetailActivity: pending,connected 2019-08-14 09:21:02.665 28687-28687/com.shanling.mwzs.debug E/GameDetailActivity: error:java.net.SocketTimeoutException:failed to connect to apkdown.mowan123.com/59.57.13.140 (port 80) from /192.168.1.114 (port 51566) after 20000ms 2019-08-14 09:21:02.734 28687-28687/com.shanling.mwzs.debug E/GameDetailActivity: pending,connected 2019-08-14 09:21:22.935 28687-28687/com.shanling.mwzs.debug E/GameDetailActivity: error:java.net.SocketTimeoutException:failed to connect to apkdown.mowan123.com/59.57.13.140 (port 80) from /192.168.1.114 (port 51568) after 20000ms 2019-08-14 09:21:22.997 28687-28687/com.shanling.mwzs.debug E/GameDetailActivity: pending,connected 2019-08-14 09:21:43.199 28687-28687/com.shanling.mwzs.debug E/GameDetailActivity: error:java.net.SocketTimeoutException:failed to connect to apkdown.mowan123.com/59.57.13.140 (port 80) from /192.168.1.114 (port 51582) after 20000ms 2019-08-14 09:21:43.261 28687-28687/com.shanling.mwzs.debug E/GameDetailActivity: pending,connected 2019-08-14 09:22:03.443 28687-28687/com.shanling.mwzs.debug E/GameDetailActivity: error:java.net.SocketTimeoutException:failed to connect to apkdown.mowan123.com/59.57.13.140 (port 80) from /192.168.1.114 (port 51584) after 20000ms 2019-08-14 09:22:03.506 28687-28687/com.shanling.mwzs.debug E/GameDetailActivity: pending,connected 2019-08-14 09:22:23.691 28687-28687/com.shanling.mwzs.debug E/GameDetailActivity: error:java.net.SocketTimeoutException:failed to connect to apkdown.mowan123.com/59.57.13.140 (port 80) from /192.168.1.114 (port 51586) after 20000ms 2019-08-14 09:22:23.750 28687-28687/com.shanling.mwzs.debug E/GameDetailActivity: pending,connected

    question 
    opened by Punishing 32
  • 出现下载不动,不回调的问题

    出现下载不动,不回调的问题

    我这里设置了超时, 还是可能会出现下载不动,不回调的问题。 设置超时的方法:

     FileDownloader.setupOnApplicationOnCreate(this)
                    .connectionCreator(new FileDownloadUrlConnection
                            .Creator(new FileDownloadUrlConnection.Configuration()
                            .connectTimeout(25_000) // set connection timeout.
                            .readTimeout(25_000) // set read timeout.
                            .proxy(Proxy.NO_PROXY) // set proxy
                    ))
                    .commit();
    

    基本描述: 我是在服务里进行多文件并行下载的。

    need-info 
    opened by qibin0506 28
  • 请问下 我设置了下载文件的绝对路径 也就是setPath 没有作用

    请问下 我设置了下载文件的绝对路径 也就是setPath 没有作用

    设置了下载路径 只是给了文件路径的参数 下载回调完成后并没有在这个路径里面找到下载的文件,我甚至不知道文件下载到哪里去了 ,居然会回调完成。我使用默认的下载路径,就能下载成功并且能正确获取到下载的文件。 还有一个问题,我使用的是FileDownloadListener这个回调,我在所有的回调方法中打上了Log,但是只有完成的方法 completed() ,调用了 ,能指导下吗 谢谢!

    question 
    opened by zxc120301945 28
  • [Small probability event]Can bring on an illegalStateException when there are multiple single tasks and queues with the same listener object, and start them in the different thread

    [Small probability event]Can bring on an illegalStateException when there are multiple single tasks and queues with the same listener object, and start them in the different thread

    异常如下: java.lang.IllegalStateException This task is running 213853733, if you want to start the same task, please create a new one by FileDownloader.create com.liulishuo.filedownloader.BaseDownloadTask.int start()(BaseDownloadTask.java:469)

    same task是如何判断的?我可以在start之前判断一下。

    bug question 
    opened by pop1030123 26
  • Context.startForegroundService did not then call Service.startForeground

    Context.startForegroundService did not then call Service.startForeground

    1. What problem do you get? Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{ad3cfbc u0 <application.package.name>/com.liulishuo.filedownloader.services.FileDownloadService$SharedMainProcessService}

    2. Which version of FileDownloader are you using when you produce such problem? 1.7.5

    3. How to reproduce such problem? When OS >= Oreo and App is still in foreground

    4. Do you set FileDownloadLog.NEED_LOG=true? Yes

    I think problem here is that in FileDownloadService class you check for needMakeServiceForeground with conditions Build.VERSION.SDK_INT >= Build.VERSION_CODES.O and !isAppOnForeground() However, if OS >= Oreo then it should always call makeServiceForeground() doesn't matter if app is in foreground or not.

    Have a look here https://developer.android.com/about/versions/oreo/background

    If you think that's correct then I can open PR

    bug 
    opened by virengujariya 24
  • FileDownloader下载某些源必现报错![已提供下载链接可复现]

    FileDownloader下载某些源必现报错![已提供下载链接可复现]

    Before Issue

    1. 针对fileDownloader的chunk问题 Issues
    2. 在OkDownload中出现的问题 Issues

    Issue

    现在遇到上面的两个问题了。我下载了这些链接: https://traffic.omny.fm/d/clips/61af0f78-644a-4500-9792-a89500ea78e5/5c2d07fe-0ef9-4b04-9646-a9d20148a726/94c08e35-dc0a-4aa8-b31b-aaf6001fa4bd/audio.mp3?utm_source=Podcast&in_playlist=e62e19db-f740-456f-b0a6-a9d2014b5993&t=1572400611

    https://downloads.wamu.org/mp3/dr/19/10/r1191015.mp3

    最终都得到了这样的错误反馈:

    require range[xxxxxx-) with contentLength(xxxxxxx), but the backend response contentLength is xxxxxxx on downloadId[-xxxxxxx]-connectionIndex[2], please ask your backend dev to fix such problem.

    当时OkDownload的作者让我使用单线程来下是可以解决这个问题的。前阵子咨询过你们同样的问题。针对fileDownloader的chunk问题 Issues 说是已经解决了,但是现在问题好像依然存在?

    bug okdownload 
    opened by kerneltea 22
  • 文件下载完后不进入Completed, 还是temp文件.

    文件下载完后不进入Completed, 还是temp文件.

    使用的版本: com.liulishuo.filedownloader:library:1.6.9 已经打开了debug log : FileDownloadLog.NEED_LOG=true;

    串行下载一批文件(8个), 最大的140M的mp4文件. new FileDownloadQueueSet(serialTarget) .setCallbackProgressTimes(1) .setAutoRetryTimes(6) .downloadSequentially(taskList) .start();

    有20%概率会有一个mp4文件一直无法完成下载, 查看后文件size已经是目标文件的大小, 但还是temp形式的文件.

    log如下:

    D/FileDownloader.SerialHandlerCallback: start next com.example.scott.zhihuiapplication.http.DownloadHelper$2@a1ee096 1 V/FileDownloader.DownloadTaskHunter: call start Url[http://xxx.com/group1/M00/00/2F/wKgBA1pqpryASTl-AN3jWeRgPLU912.mp4], Path[/storage/emulated/0/XinFa/download/wKgBA1pqpryASTl-AN3jWeRgPLU912.mp4] Listener[com.example.scott.zhihuiapplication.http.DownloadHelper$2@a1ee096], Tag[2] V/FileDownloader.DownloadTaskHunter: the task[-1634755956] has been into the launch pool. D/FileDownloader.FileDownloadMessenger: notify begin [email protected]@88c7004 V/FileDownloader.DownloadTaskHunter: filedownloader:lifecycle:start com.liulishuo.filedownloader.DownloadTaskHunter@f6de234 by 11 D/FileDownloader.MessageSnapshotGate: ~~~callback -1634755956 old[5] new[-4] 2 D/FileDownloader.DownloadTaskHunter: can't update mStatus change by keep flow, 5, but the current mStatus is 5, -1634755956 D/FileDownloader.FileDownloadMessenger: notify warn [email protected]@88c7004 V/FileDownloader.DownloadTaskHunter: filedownloader:lifecycle:over com.liulishuo.filedownloader.DownloadTaskHunter@f6de234 by -4 D/FileDownloader.SerialHandlerCallback: start next com.example.scott.zhihuiapplication.http.DownloadHelper$2@a1ee096 2 V/FileDownloader.DownloadTaskHunter: call start Url[http://xxx.com/group1/M00/00/32/wKgBA1qcpE-Abn4HAMS0WxheBrQ969.mp4], Path[/storage/emulated/0/XinFa/download/wKgBA1qcpE-Abn4HAMS0WxheBrQ969.mp4] Listener[com.example.scott.zhihuiapplication.http.DownloadHelper$2@a1ee096], Tag[3] V/FileDownloader.DownloadTaskHunter: the task[139022803] has been into the launch pool. D/XINFA: FileDownloadListener Finished downloading http://xxxx.com/group1/M00/00/2D/wKgBo1qACzCAGXFFAAAGe5h1_aI469.jpg D/XINFADIAGNOSIS: ......文件下载完成( wKgBo1qACzCAGXFFAAAGe5h1_aI469.jpg) (tag:1) D/XINFA: Program downloading process (14678) : 8 : 1 : 12 D/FileDownloader.FileDownloadMessenger: notify begin [email protected]@50519ed V/FileDownloader.DownloadTaskHunter: filedownloader:lifecycle:start com.liulishuo.filedownloader.DownloadTaskHunter@5679d2a by 11 D/FileDownloader.MessageSnapshotGate: ~~~callback 139022803 old[11] new[-3] 1 D/FileDownloader.FileDownloadMessenger: notify block completed [email protected]@50519ed FileDownloader-LauncherTask12 D/XINFA: FileDownloadListener.blockComplete D/FileDownloader.FileDownloadMessenger: notify completed [email protected]@50519ed V/FileDownloader.DownloadTaskHunter: filedownloader:lifecycle:over com.liulishuo.filedownloader.DownloadTaskHunter@5679d2a by -3


    看log里, 有这样一句和其他不同: can't update mStatus change by keep flow, 5, but the current mStatus is 5, -1634755956

    need-info 
    opened by espring 21
  • Crash

    Crash

    java.lang.NullPointerException: at java.io.File.fixSlashes (File.java:185) at java.io.File. (File.java:134) at com.liulishuo.filedownloader.download.DownloadRunnable.run (DownloadRunnable.java:121) at com.liulishuo.filedownloader.download.DownloadLaunchRunnable.realDownloadWithSingleConnection (DownloadLaunchRunnable.java:593) at com.liulishuo.filedownloader.download.DownloadLaunchRunnable.run (DownloadLaunchRunnable.java:294) at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:587) at java.lang.Thread.run (Thread.java:818)

    question 
    opened by Jeffin21 20
  • Get file size prior to start downloading it

    Get file size prior to start downloading it

    I've started using the library and gone through the simple implementation, although it doesn't tell about implementation of getting size of file before actually downloading it.

    What i tried so far is

    String downloadLink = VALID_FILE_URL;
    String filePath = Environment.getExternalStorageDirectory() + File.separator + Environment.DIRECTORY_DOWNLOADS + File.separator + "file.mp4";
    Logger.log(String.valueOf(FileDownloader.getImpl().create(downloadLink).setPath(filePath).getSmallFileTotalBytes()));
    

    but it's returning 0.00 every time i execute the above code.

    question 
    opened by nitinmishra27 19
  • W/FileDownloader.FileDownloadUtils: don't get instance length fromContent-Range header

    W/FileDownloader.FileDownloadUtils: don't get instance length fromContent-Range header

    下载报错,之前还好好的,现在header获取长度一直为0,没办法进行下载。

    2022-10-18 09:08:35.368 6844-6844/tai.tan.nanningrailway E/--bytes--: 0 === 0 2022-10-18 09:08:35.424 7172-7235/tai.tan.nanningrailway W/FileDownloader.FileDownloadUtils: don't get instance length fromContent-Range header 2022-10-18 09:08:35.505 6844-6844/tai.tan.nanningrailway E/------error-----: there isn't any content need to download on 2001696028--1 with the content-length is 0

    opened by rebertBen 1
  • startForegroundService() not allowed due to mAllowStartForeground false

    startForegroundService() not allowed due to mAllowStartForeground false

    Need to adopt Android 12 behavior changes, can't start foreground service from the background.

    Fatal Exception: android.app.ForegroundServiceStartNotAllowedException: startForegroundService() not allowed due to mAllowStartForeground false:
    service messenger.MainActivity.launcher.home.screen/com.liulishuo.filedownloader.services.FileDownloadService$SharedMainProcessService
        at android.app.ForegroundServiceStartNotAllowedException$1.createFromParcel(ForegroundServiceStartNotAllowedException.java:54)
        at android.app.ForegroundServiceStartNotAllowedException$1.createFromParcel(ForegroundServiceStartNotAllowedException.java:50)
        at android.os.Parcel.readParcelable(Parcel.java:3345)
        at android.os.Parcel.createExceptionOrNull(Parcel.java:2432)
        at android.os.Parcel.createException(Parcel.java:2421)
        at android.os.Parcel.readException(Parcel.java:2404)
        at android.os.Parcel.readException(Parcel.java:2346)
        at android.app.IActivityManager$Stub$Proxy.startService(IActivityManager.java:6968)
        at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1927)
        at android.app.ContextImpl.startForegroundService(ContextImpl.java:1893)
        at android.content.ContextWrapper.startForegroundService(ContextWrapper.java:798)
        at g7.d.a(FileDownloadServiceSharedTransmit.java:8)
        at g7.d.x099(:1)
        at g7.c.x099(:2)
        at g7.g.x022(FileDownloader.java:3)
        at mymessenger.messaging.module.ui.main.MainFragment.onCreate(MainFragment.java:2)
        at androidx.fragment.app.Fragment.performCreate(Fragment.java:6)
        at androidx.fragment.app.FragmentStateManager.create(FragmentStateManager.java:5)
        at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:21)
        at androidx.fragment.app.FragmentStore.moveToExpectedState(FragmentStore.java:3)
        at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:57)
        at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3)
        at androidx.fragment.app.FragmentManager.dispatchActivityCreated(FragmentManager.java:4)
        at androidx.fragment.app.FragmentController.dispatchActivityCreated(:4)
        at androidx.fragment.app.FragmentActivity.onStart(FragmentActivity.java:6)
        at androidx.appcompat.app.AppCompatActivity.onStart(AppCompatActivity.java:1)
        at com.android.launcher3.BaseActivity.onStart(BaseActivity.java:2)
        at com.android.launcher3.BaseDraggingActivity.onStart(BaseDraggingActivity.java:1)
        at com.android.launcher3.Launcher.onStart(Launcher.java:2)
        at my.MainActivity.onStart(MainActivityLauncher.kt:1)
        at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1455)
        at android.app.Activity.performStart(Activity.java:8315)
        at android.app.ActivityThread.handleStartActivity(ActivityThread.java:4060)
        at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:221)
        at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201)
        at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2438)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loopOnce(Looper.java:226)
        at android.os.Looper.loop(Looper.java:313)
        at android.app.ActivityThread.main(ActivityThread.java:8669)
        at java.lang.reflect.Method.invoke(Method.java)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
    
    
    
    opened by Goooler 0
Releases(v1.7.5)
  • v1.7.5(Aug 3, 2018)

    中文迭代日志

    Version 1.7.5

    2018-08-03

    Fix

    • Fix: fix raise "Not allowed to start service Intent..." issue when starting DownloadService on Android O and the application isn't on the foreground and also not on the whitelist, because we can't use JobScheduler to handle the download affair. closes #1078

    Enhance

    • Improve Practicability: support character set and the language encoding for Content-Disposition. closes #1057
    • Improve Practicability: cover the error response code 416 from aliyun repo. closes #1050
    Source code(tar.gz)
    Source code(zip)
  • v1.7.4(May 19, 2018)

    中文迭代日志

    Version 1.7.4

    2018-05-19

    Fix

    • Fix: fix raise 'IllegalStateException' on Android 8+ when FileDownloader try to re-bind service after the connection with the service is lost on downloading state and the app is on the background. closes #1017
    • Fix: fix the directory traversal vulnerability security issue. closes #1028
    Source code(tar.gz)
    Source code(zip)
  • v1.7.3(Apr 20, 2018)

  • v1.7.2(Mar 13, 2018)

    中文迭代日志

    Version 1.7.2

    2018-03-14

    Fix

    • Fix: do not download callback error when the instance length of the task is zero, callback complete directly instead. closes #789
    • Fix: fix the temp duplicate data in the database isn't removed when there is another running task with the same temp file path. closes #953
    • Fix: the data lost when retry. closes #949
    • Fix: fix the instance-length is always 1 when the Content-Range isn't provided but the Content-Length is provided on the trial connection.

    Enhancement

    • Improve Practicability: using the content length value on the Content-Range field when there isn't Content-Length field found in the response header. closes #967
    Source code(tar.gz)
    Source code(zip)
  • v1.7.1(Feb 5, 2018)

  • v1.7.0(Feb 1, 2018)

    中文迭代日志

    Fix

    • Fix: fix update status can't keep flow through making updating status synchronized with pause action. close #889
    • Fix: fix the sofar-bytes carry back through pending state callback has already discarded. close #884
    • Fix: fix can't find filename if filename value on content-disposition without around with ". close #908
    • Fix: correct setCallbackProgressTimes method make setCallbackProgressTimes work correctly. close #901
    • Fix: fix download useless data on tcp-window because of the first trial connection use 0-infinite range. close #933
    • Fix: close input stream when connection ending avoids input-stream leak especially for the trial connection.

    Enhancement

    • Improve Practicability: do not remove the temp-file if rename it to the target path success to prevent raise some file-system problem. close #912
    • Improve Practicability: discard range totally if the range is right but backend response 416. close #921
    • Improve Performance: using HEAD request method instead of GET method for trial connect. ref #933
    Source code(tar.gz)
    Source code(zip)
  • v1.6.9(Dec 16, 2017)

    中文迭代日志

    Version 1.6.9

    2017_12_16

    Fix

    • Fix(serial-queue): fix deadlock on FileDownloadSerialQueue. closes #858
    • Fix: do not use j-unit on library non-unit-test env to fix the no-static-method-found issue on some mi-phones. closes #867
    • Fix: fix decrease two times of retry-chance each time of retry. closes #838
    • Fix: fix get status is pending when a task has been paused on pending status. closes #855

    Enhancement

    • Improve Practicability: public SqliteDatabaseImplRemitDatabaseNoDatabaseImpl, so you can overwrite them
    • Improve Practicability: support downgrade version from newer version
    • Improve Practicability: add the default User-Agent if upper layer does not add. closes #848
    • Improve Performance: change the keepalive second(5s to 15s) for each executor, since when downloading multiple tasks thread release and recreate too frequently
    • Improve Performance: using RemitDatabase instead of DefaultFiledownloadDatabase to avoid some small task start and finished on the very short time but consume too much time on sync status to database what is useless

    Source code(tar.gz)
    Source code(zip)
  • v1.6.8(Oct 13, 2017)

    中文迭代日志

    • Fix: fix resume from breakpoint failed because of isAlive not guarantee on Network-thread. this closes #793
    • Fix: fix resume from breakpoint failed, because of multi-thread update status very frequently and Messenger can't guarantee order. this refs #793, #764, #721, #769, #763, #761, #716
    • Fix: do not crash user when a task has finished but the messenger still has messages, because it's fine for the user. this closes #562
    • Fix: fix the callback error of 'it can't take a snapshot for the task xxx' when a user invokes pause very frequently.
    • Fix: fix the case of process on the model is wrong which raise 416 each time when restarting it.
    Source code(tar.gz)
    Source code(zip)
  • v1.6.7(Oct 12, 2017)

    中文迭代日志

    Fix

    • Fix: Avoid error/pause status is covered by other processing-status which will cause resume-failed, task-never-end. this closes #769, closes #764, closes #761, closes #763, closes #721, closes #716
    • Fix: Fix request range value turn to negative when resuming a task which has a process more than 1.99G on its one block. Thanks to @hongbiangoal closes #791
    Source code(tar.gz)
    Source code(zip)
  • v1.6.6(Sep 29, 2017)

    中文迭代日志

    Fix

    • Fix(file-integrality): update the process to the database only if all buffers on output-stream or system have been flush and sync to device successfully to avoid resume on the wrong point raise complete file, not integrality. Closes #745
    • Fix(clear): fix FileDownloader#clearAllTaskData not clear connection table. Closes #754

    Enhancement

    • Import Performance: optimize the default output-stream with buffered-output-stream, now the VM buffers length is 8192 bytes.
    Source code(tar.gz)
    Source code(zip)
  • v1.6.5(Sep 11, 2017)

  • v1.6.4(Aug 21, 2017)

    中文迭代日志

    Version 1.6.4

    2017-08-21

    New Interfaces

    • Add NoDatabaseImpl for the case of some users need a no-database FileDownloader. Refs #727

    Enhancement

    • Import Performance: Using the AtomicLong instead of lock to make better efficiency on increase progressing.

    Fix

    • Fix: Fix response 416 http status because of the last connection range is wrong when resume downloading with the last connection has been downloaded. Closes #737
    • Fix(npe): Fix the small probability NPE crash when publishing event with it has been removed on other thread. Closes #723
    Source code(tar.gz)
    Source code(zip)
  • v1.6.3(Jul 29, 2017)

    中文迭代日志

    Version 1.6.3

    2017-07-29

    Fix

    • Fix: Fix the small probability occur npe when the task is calling back over status with user invoke pause simultaneously. Closes #680
    • Fix: Fix MissingFormatArgumentException when you pause or resume the FileDownloadserialQueue with it has already done it. Closes #699
    Source code(tar.gz)
    Source code(zip)
  • v1.6.2(Jul 16, 2017)

  • v1.6.1(Jul 13, 2017)

    中文迭代日志

    Enhancement

    • Import Practicability: Throw GiveUpException directly when the response content-length isn't equal to the expect content-length calculated from range. Closes #636

    Fix

    • Fix: Fix sync twice when downloading paused/error.
    • Fix: fix file is destroyed when you download chunked file from breakpoint.
    Source code(tar.gz)
    Source code(zip)
  • v1.6.0(Jul 6, 2017)

  • v1.5.9(Jul 4, 2017)

    中文迭代日志

    Fix

    • Fix(duplicate-permission): fix INSTALL_FAILED_DUPLICATE_PERMISSION when there are more than one application using FileDownloader lib 1.5.7 or more newer since Android 5.0. This problem is raised since v1.5.7, because of we declared permission for receiving completed status broadcast more secure, now we remove it to fix this problem. Closes #641
    Source code(tar.gz)
    Source code(zip)
  • v1.5.8(Jun 28, 2017)

  • v1.5.7(Jun 25, 2017)

    中文迭代日志

    Version 1.5.7

    2017-06-25

    New Interfaces

    • Support the configuration broadcast.completed in filedownloader.properties: determine whether need posts a broadcast when a task is completed. Closes #605
    • Support accepting 201 http status. Closes #545
    • Support pause and resume for the FileDownloadSerialQueue. Closes #547
    • Handle the case of redirect(300、301、302、303、307、308) on FileDownloader self. Closes #611
    • Deprecated the FileDownloader#init and add the replacer FileDownloader#setup to let user invoke anytime before using Filedownloader. Closes #500
    • If you want to using broadcast.completed and receive completed broadcast, you also need to declare filedownloader.permission.RECEIVE_STATE permission on the manifest, and register receiver with filedownloader.intent.action.completed action name and please using FileDownloadBroadcastHandler class to parse the received Intent.
    • Now, rather than using FileDownloader#init, if you want to register your own customize components for FileDownloader please invoking FileDownloader.setupOnApplicationOnCreate(application):InitCustomMaker on the Application#onCreate, otherwise you just need invoke FileDownloader.setup(Context) anytime before using FileDownloader.

    Fix

    • Fix: fix FileDownloadQueueSet can't handle the case of disable wifi-required. Thanks @qtstc
    • Fix(output-stream): fix broken support for output-stream when it doesn't support seek. Closes #622

    Enhancement

    • Improve Practicability: Cover the case of reusing the downloaded processing with the different url( using with idGenerator ). Closes #617
    Source code(tar.gz)
    Source code(zip)
  • v1.5.6(Jun 18, 2017)

    中文迭代日志

    Version 1.5.6

    2017-06-18

    Fix

    • Fix(crash): fix raise NPE crash when require paused a task and invoking findRunningTaskIdBySameTempPath at the same time. Closes #613
    • Fix(crash): fix raise IllegalArgumentException when the response code is 206 and its ETAG is changed. Closes #612
    • Fix(crash): fix raise FileDownloadNetworkPolicyException unhandled exception, when user enable wifi-required but no wifi-state. Thanks @qtstc
    • Fix(crash): fix raise IllegalStateException when user upgrades from v1.4.3 or older version to v1.5.2 or newer version directly and some more conditions, more detail please move to #610
    • Fix(crash): fix some small probability case raise IllegalStateException when callback-flow has been finalized but occurring completed/error at the same time.
    • Fix(no-response): fix no-response after start download and receive connected callback because the resource state has been changed during the connection of verification and connections of fetch data.

    Enhancement

    • Improve Practicability: callback error directly when creating the parent directory failed. Closes #542
    • Improve Practicability: handle the case of response code is 416. Closes #612
    Source code(tar.gz)
    Source code(zip)
  • v1.5.5(Jun 12, 2017)

    中文迭代日志

    Fix

    • Fix(max-network-thread-count): fix the download.max-network-thread-count not work and there are no restrictions on the number of tasks downloaded at the same time since v1.5.0 when tasks runs on the multi-connection Closes #607
    Source code(tar.gz)
    Source code(zip)
  • v1.5.4(Jun 11, 2017)

    中文迭代日志

    Version 1.5.4

    2017-06-11

    New Interfaces

    • Support customizing the download task identify generator through IdGenerator. Closes #224

    Enhancement

    • Improve Practicability: Decoupling the FileDownloadDatabase with FileDownloadModel, let FileDownloadDatabase only care about database operation.
    • Improve Practicability: Decoupling the database initial-maintain from the FileDownloadDatabase default implementation to let the customized database can be maintained.
    Source code(tar.gz)
    Source code(zip)
  • v1.5.3(Jun 8, 2017)

    中文迭代日志

    Version 1.5.3

    2017-06-08

    Fix

    • Fix(crash): Fix divide by zero on calculating average speed when download completed and connected at the same time. Refs #601
    • Fix(crash): Fix raise NPE crash when you require pause the task between executed the fetch-data-task and fetch-data-task has not yet started. Closes #601
    Source code(tar.gz)
    Source code(zip)
  • v1.5.2(Jun 7, 2017)

    中文迭代日志

    Version 1.5.2

    2017-06-07

    Fix

    • Fix(crash): Fix raising NPE crash or ConcurrentModificationException when the Task is paused or error with the connection is completing at the same time. Closes #598
    • Fix(crash): Fix raising NPE crash when pausing the FetchDataTask and it still without any time to sync data to database or file-system. Refs #598
    • Fix(crash): Fix raising NPE crash when using the multiple connections to download and connect failed or create FetchDataTast failed. Refs #598
    • Fix(speed-calculate): Fix the speed result is 0 when ignoring all processing callbacks and just using FinishListener.
    • Fix(finish-listener): Fix there isn't over callback for the FinishListener when the file has already been downloaded in the past.

    Enhancement

    • Improve Performance: Enable the WAL for the default SQLite to speed up SQL operation because the most of our case is concurrently accessed and modified by multiple threads at the same time.
    Source code(tar.gz)
    Source code(zip)
  • v1.5.1(Jun 5, 2017)

    中文迭代日志

    Version 1.5.1

    2017-06-05

    Fix

    • Fix(crash): Fix the NPE crash when don't provide the InitCustomMaker on FileDownloader#init. Closes #592
    • Fix(callback): Fix on the pending callback you can't get the right sofarBytes when there are several connections served for the task and the task is resuming from the breakpoint.
    • Fix(speed-monitor): Correct the result of the total average speed when the task resume from a breakpoint on IDownloadSpeed.Monitor.

    Enhancement

    • Improve Robust: Sync all process on fetch task manually when it is paused to make the process can be persisted.
    • Improve Robust: Raise IllegalArgumentException when provide context is null on FileDownloader.init to expose the problem earlier.
    Source code(tar.gz)
    Source code(zip)
  • v1.5.0(Jun 4, 2017)

    中文迭代日志

    Version 1.5.0

    2017-06-05

    New Interfaces

    • Improve Practicability: Support multiple-connection(multiple threads) for one downloading task. Closes #102
    • Improve Practicability: Support ConnectionCountAdapter to customize connection count for each task(you can set it through FileDownloader#init).
    • Improve Performance: Refactor whole download logic and origin callback logic and remove 1000 line class FileDownloadRunnable.

    The default connection count strategy for each task, you can customize it through ConnectionCountAdapter:

    • one connection: file length [0, 1MB)
    • two connections: file length [1MB, 5MB)
    • three connections: file length [5MB, 50MB)
    • four connections: file length [50MB, 100MB)
    • five connections: file length [100MB, -]
    Source code(tar.gz)
    Source code(zip)
  • v1.4.3(May 7, 2017)

  • v1.4.2(Mar 14, 2017)

    中文

    Fix

    • Fix(Same File Path): Avoid two tasks writing to the same file simultaneously, Once there is an another running task with the same target path to the current task's, the current task will receive the PathConflictException to refused start downloading. Closes #471

    New Interfaces

    • Add FileDownloadSerialQueue#getWaitingTaskCount: Get the count of tasks which is waiting on the serial-queue instance. Refs #345
    Source code(tar.gz)
    Source code(zip)
  • v1.4.1(Feb 2, 2017)

    中文

    Fix

    • Fix(High concurrency): Fix occurring the NPE crash because of it still receiving message-snapshot in the messenger but the host task has been assigned to null since it has been received over-status message-snapshot. Closes #462
    • Fix(FileDownloadHttpException): Fix occurring the IllegalStateException because of cannot access request header fields after connection is set when occurring http-exception. Closes #458
    Source code(tar.gz)
    Source code(zip)
  • v1.4.0(Jan 10, 2017)

    中文

    Enhancement

    • Improve Performance: Optimize the logic in FileDownloader#init, let it lighter(just do some action like assign context and maker)

    Fix

    • Fix(pause): fix can't stop the task when occurring the high concurrency event about pausing task after starting it in very close time. Closes #402
    • Fix(init FileDownloader): fix the very low frequent crash when init FileDownloader on the process the FileDownloadService settled on. Closes #420
    • Fix(FileDownloadHttpException): fix params can't match the formatter when occur FileDownloadHttpException Closes #438
    Source code(tar.gz)
    Source code(zip)
Owner
LAIX Inc. (formerly LingoChamp Inc.)
We're hiring in Shanghai and Hangzhou.
LAIX Inc. (formerly LingoChamp Inc.)
Cache support for any video player with help of single line

Video cache support for Android Table of Content Why AndroidVideoCache? Features Get started Recipes Disk cache limit Listen caching progress Providin

Alexey Danilov 5.1k Jan 6, 2023
An instance-state saving fragment switcher, intended for use with navigation drawers or tabs.

FragmentSwitcher FragmentSwitcher is an adapter-based, state-saving fragment container similar to a ViewPager. It was designed with the NavigationDraw

Jacob Tabak 247 Dec 30, 2022
****. Use the native and support library variants instead - https://developer.android.com/guide/topics/ui/look-and-feel/fonts-in-xml.html. An android library that makes it easy to add custom fonts to edittexts and textviews

Add to your project Add this line to your dependencies in build.gradle compile 'in.workarounds.typography:typography:0.0.8' Using the views There are

Workarounds 43 Nov 6, 2021
Highly experimental predefined Bootstrap functions to use in Compose Web

bootstrap-compose Highly experimental predefined Bootstrap functions to use in Compose Web Install This package is uploaded to MavenCentral. repositor

Philip Wedemann 45 Jan 6, 2023
Use your old Android device as an OctoPrint server.

Use your old Android device as an OctoPrint server.

Feelfree (Filip) 1k Dec 31, 2022
KodeEditor - A simple code editor with syntax highlighting and pinch to zoom

KodeEditor - A simple code editor with syntax highlighting and pinch to zoom

Markus Ressel 65 Oct 28, 2022
A simple screen starter written in kotlin

screen-starter A simple screen starter written in kotlin. Compilation Use clean shadowJar! Usage Use java -jar screen-starter-1.0-SNAPSHOT.jar --confi

GrowlyX 3 Sep 1, 2021
This repository contains a simple script that lets you kill gradle and kotlin daemons.

AndroidDaemonKiller This repository contains a simple script that lets you kill gradle and kotlin daemons. After updating gradle or kotlin or checking

Paul Woitaschek 25 Dec 3, 2022
Simple Artificial Neural Network java library

SANN Simple Artificial Neural Network java library WIP Creating neural network Variant 1 //create new net (input, hidden, default len, output) Net net

Korpusov Maxim 14 Oct 11, 2022
Simple system for building dialogue in Cepi

Dialogue Dialogue builder for Cepi Installation Download the jar from Releases OR compile it yourself. Instructions to do so are in Compile header Dro

Cepi 2 Dec 14, 2022
A simple and scalable Android bot emulation framework, as presented at Black Hat Europe's Arsenal

m3 A simple and scalable Android bot emulation framework. A detailed explanation can be found here. This project was first published at Black Hat Euro

null 22 Aug 20, 2022
Create a simple one screen application with scrollable table view

Create a simple one screen application with scrollable table view

Nikola Crnogorac 0 Jan 2, 2023
Simple spring boot JWT authentication example

JWT authentication This an example how to set up jwt authentication with access and refresh token. Related blog post is available here: https://coding

null 1 Feb 9, 2022
Concurrency-programming - Homework for the course of Concurrency Programming, ITMO CT, Autumn 2020

Homework for the course of Concurrency Programming, ITMO CT, Autumn 2020 Выполни

Grigoriy Khlytin 2 Jan 23, 2022
Resume of Louis CAD, made with Jetpack Compose. Supports the Web, Desktop, and Android.

ResumeComposition What This project is the source code of the resume/CV of Louis CAD. The latest PDF export is available here, it is ready to print. H

Louis CAD 22 Aug 14, 2022
Base on android-process-button this is the advanced version of the android-process-button.

Rock Button release log Base on android-process-button this is the advanced version of the android-process-button ##Main Features ActionProcessButton

MDCCLXXVI KPT 119 Nov 25, 2022
Text-array-process - A home assignment used during the recruitment process at Lumera

Rules to implement class={isogram|palindrome|semordnilap} maxlength=<INT> minl

Mầu Tiến Đoàn 0 Jan 27, 2022
LiteGo is a Java-based asynchronous concurrency library. It has a smart executor, which can be freely set the maximum number of concurrent at same time , and the number of threads in waiting queue. It can also set waiting policies and overload strategies.

LiteGo:「迷你」的Android异步并发类库 LiteGo是一款基于Java语言的「异步并发类库」,它的核心是一枚「迷你」并发器,它可以自由地设置同一时段的最大「并发」数量,等待「排队」线程数量,还可以设置「排队策略」和「超载策略」。 LiteGo可以直接投入Runnable、Callable

马天宇 189 Nov 10, 2022
Whereabouts: an android library which leverages Kotlin concurrency to streamline location fetching

Whereabouts Whereabouts is an android library which leverages Kotlin concurrency

Sumeet Rukeja 1 Jul 5, 2022
Reason about resource-safety in the same way you reason about Structured Concurrency with SuspendApp!

Reason about resource-safety in the same way you reason about Structured Concurrency with SuspendApp!

ΛRROW 34 Dec 21, 2022