• Stars
    star
    11,031
  • Rank 3,061 (Top 0.07 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created almost 9 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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.

More Repositories

1

okdownload

A Reliable, Flexible, Fast and Powerful download engine.
Java
5,178
star
2

MagicProgressWidget

MagicProgressCircle & MagicProgressBar
Java
728
star
3

ShareLoginLib

ThirdParty login and share lib
Java
702
star
4

Diplomat

整合第三方 SDK 微信、微博、 QQ 等为统一的 Diplomat 接口。
Objective-C
661
star
5

QiniuImageLoader

在Android上结合七牛提供的API,让加载图片更有效、更节流、更简单、更可控、更酷
Java
524
star
6

okcheck

Incremental scan,integrate Lint、KtLint、UnitTest、Checkstyle、Findbugs、Pmd, powerful and easy to use
Groovy
309
star
7

LingoRecorder

LingoRecorder is a better recorder for Android, you can easily process pcm from it.
Java
184
star
8

FuriganaTextView

A simple wrapper view for UITextView that can display Furiganas.
Swift
133
star
9

SpanEllipsizeEnd

处理 Span 在 最大宽度文字尾省略号,无效的问题。
Java
89
star
10

Multi-Scale-BERT-AES

Demo for the paper "On the Use of BERT for Automated Essay Scoring: Joint Learning of Multi-Scale Essay Representation"
Python
56
star
11

tensorflow-dkt

Build DKT (Deep Knowledge Tracing) model with TensorFlow
Python
47
star
12

OnlineScorer-Wechat

流利说在线录音打分微信版SDK
JavaScript
37
star
13

OnlineScorer-Android

C
12
star
14

OnlineScorer-iOS

OnlineScorerRecorder for iOS
Objective-C
9
star
15

Mercury

Kotlin
9
star
16

OnlineScorer-Web

JavaScript
6
star
17

open-asr

Python
5
star
18

language-coursescript

Syntax highlighting and snippets for CourseScript.
CoffeeScript
3
star
19

open-wechat-scorer

Server-side SDK for Liulishuo Open Platform
Python
1
star
20

PTSDK-iOS

PTSDK Framework for iOS
Swift
1
star
21

cares

A forked c-ares repository to make GRPC compilation less painful
C
1
star