Android 下载库:okdownload

jopen 9年前

Okdownload 是基于 Okhttp 的 Android 下载库,数据库使用 SQLite,简单小巧。

示例代码:

OkDownloadRequest request = new OkDownloadRequest.Builder()                              .url(url)                              .filePath(filePath)                              .build();     OkDownloadManager.getInstance(mContext).enqueue(request, listener);     OkDownloadEnqueueListener listener = new OkDownloadEnqueueListener() {             @Override          public void onStart(int id) {              Log.e("OkDownload", "onStart : the download request id = "+id);          }             @Override          public void onProgress(int progress, long cacheSize, long totalSize) {              Log.e("OkDownload", cacheSize + "/" + totalSize);          }             @Override          public void onRestart() {              Log.e("OkDownload", "onRestart");          }             @Override          public void onPause() {              Log.e("OkDownload", "onPause");          }             @Override          public void onCancel() {              Log.e("OkDownload", "onCancel");          }             @Override          public void onFinish() {              Log.e("OkDownload", "onFinish");          }             @Override          public void onError(OkDownloadError error) {              Log.e("OkDownload", error.getMessage());          }      };

Android 下载库:okdownload

项目主页:http://www.open-open.com/lib/view/home/1448889279936