MyGit

lingochamp/FileDownloader

Fork: 2202 Star: 11051 (更新于 2024-12-17 00:04:09)

license: Apache-2.0

Language: Java .

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

最后发布版本: v1.7.5 ( 2018-08-03 16:15:47)

GitHub网址

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.

最近版本更新:(数据更新于 2024-09-10 14:10:54)

2018-08-03 16:15:47 v1.7.5

2018-05-19 23:59:07 v1.7.4

2018-04-20 23:14:00 v1.7.3

2018-03-14 00:59:14 v1.7.2

2018-02-05 19:39:48 v1.7.1

2018-02-01 23:56:41 v1.7.0

2017-12-16 10:43:27 v1.6.9

2017-10-13 21:27:18 v1.6.8

2017-10-12 13:29:33 v1.6.7

2017-09-29 17:13:10 v1.6.6

主题(topics):

android, breakpoint, download, downloader, filedownloader, high-concurrency, multiple-process, multiple-thread, multitasking

lingochamp/FileDownloader同语言 Java最近更新仓库

2024-12-20 19:54:15 mybatis-flex/mybatis-flex

2024-12-19 21:53:46 spring-projects/spring-boot

2024-12-19 21:25:16 Stirling-Tools/Stirling-PDF

2024-12-19 16:28:14 Tornaco/Thanox

2024-12-19 10:42:01 alibaba/nacos

2024-12-18 20:58:34 dromara/forest