下载不应该是让人感到痛苦的功能,Aria,致力于让下载傻瓜化。
- Aria有以下特点:
- 简单
- 可自定义是否使用广播
- 支持多线程、多任务下载
- 支持任务自动切换
- 支持下载速度直接获取
如果你觉得Aria对你有帮助,您的star和issues将是对我最大支持.^_^
compile 'com.arialyy.aria:Aria:2.3.2'
DownloadEntity mEntity = new DownloadEntity();
mEntity.setFileName(fileName); //设置文件名
mEntity.setDownloadUrl(downloadUrl); //设置下载链接
mEntity.setDownloadPath(downloadPath); //设置存放路径
@Override protected void onResume() {
super.onResume();
Aria.whit(this).addSchedulerListener(new MySchedulerListener());
}
-
启动下载
Aria.whit(this).load(mEntity).start();
-
暂停下载
Aria.whit(this).load(mEntity).stop();
-
恢复下载
Aria.whit(this).load(mEntity).resume();
-
取消下载
Aria.whit(this).load(mEntity).cancel();
-
设置下载任务数,Aria默认下载任务为2
Aria.get(getContext()).setMaxDownloadNum(num);
-
停止所有下载
Aria.get(this).stopAllTask();
-
设置失败重试次数,从事次数不能少于 1
Aria.get(this).setReTryNum(10);
-
设置失败重试间隔,重试间隔不能小于 5000ms
Aria.get(this).setReTryInterval(5000);
-
设置是否打开广播,如果你需要在Service后台获取下载完成情况,那么你需要打开Aria广播,Aria广播配置
Aria.get(this).openBroadcast(true);
- v_2.1.0 修复大量bug
- v_2.1.1 增加,选择最大下载任务数接口
- v_2.3.1 重命名为Aria,下载流程简化
Copyright 2016 AriaLyy(https://github.com/AriaLyy/Aria)
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.