# OkhttpDownloader **Repository Path**: shenzhenjinma/OkhttpDownloader ## Basic Information - **Project Name**: OkhttpDownloader - **Description**: a multi-thread downloader for okhttp! - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-10-13 - **Last Updated**: 2021-11-03 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # OkhttpDownloader a multi-thread downloader for okhttp! # Dependencies [![](https://jitpack.io/v/li-xiaojun/OkhttpDownloader.svg)](https://jitpack.io/#li-xiaojun/OkhttpDownloader) **Step 1.** Add the JitPack repository to your build file ```groovy allprojects { repositories { ... maven { url 'https://jitpack.io' } } } ``` **Step 2.** Add the dependency ```groovy dependencies { compile 'com.github.li-xiaojun:OkhttpDownloader:latest release' } ``` # Screenshot ![1](/screenshot/1.gif) ![2](/screenshot/2.gif) # Feature - multi-thread download - support break-download - db save downloadInfo # How To Use - 下载方法: ```java //需要自己维护任务id DownloadEngine.create(this).download(taskId, url, path); ``` - 暂停方法: ```java DownloadEngine.create(this).pause(taskId); ``` - 设置最大同时运行的任务数量: ```java DownloadEngine.create(this).setMaxTaskCount(5); ``` - 添加和移除下载监听器: ```java //添加 DownloadEngine.create(this).addDownloadObserver(new DownloadEngine.DownloadObserver() { @Override public void onDownloadUpdate(DownloadInfo downloadInfo) { } },taskId...); //移除 DownloadEngine.create(this).removeDownloadObserver(this); ``` - 获取下载详细数据: ```java DownloadEngine.create(this).getDownloadInfo(taskId); ``` - 删除下载数据,同时删除数据库记录和本地文件: ```java DownloadEngine.create(this).deleteDownloadInfo(downloadInfo); ``` ​