public void downloadApkFile(
     String url,
     String fileName,
     String pkg,
     int versionCode,
     String savePath,
     boolean autoResume,
     final RequestCallBack<File> callback)
     throws DbException {
   if (checkDownloaded(pkg, versionCode, savePath)) {
     PackageUtils.installApp(mContext, savePath);
     return;
   }
   String tmpApkPath = savePath + getMD5ApkTmpName(pkg, versionCode);
   String apkPath = savePath + getMD5ApkName(pkg, versionCode);
   final DownloadInfo downloadInfo = new DownloadInfo();
   downloadInfo.setDownloadUrl(url);
   downloadInfo.setAutoResume(autoResume);
   downloadInfo.setFileName(fileName);
   downloadInfo.setFileTmpPath(tmpApkPath);
   downloadInfo.setFileSavePath(apkPath);
   downloadInfo.setPkg(pkg);
   downloadInfo.setVersionCode(versionCode);
   downloadInfo.setAutoRenameTmp(true);
   HttpUtils http = new HttpUtils();
   http.configRequestThreadPoolSize(maxDownloadThread);
   HttpHandler<File> handler =
       http.download(url, tmpApkPath, autoResume, new ManagerCallBack(downloadInfo, callback));
   downloadInfo.setHandler(handler);
   downloadInfo.setState(handler.getState());
   downloadInfoList.add(downloadInfo);
   db.saveBindingId(downloadInfo);
 }
 public void resumeDownload(DownloadInfo downloadInfo, final RequestCallBack<File> callback)
     throws DbException {
   HttpUtils http = new HttpUtils();
   http.configRequestThreadPoolSize(maxDownloadThread);
   HttpHandler<File> handler =
       http.download(
           downloadInfo.getDownloadUrl(),
           downloadInfo.getFileSavePath(),
           downloadInfo.isAutoResume(),
           new ManagerCallBack(downloadInfo, callback));
   downloadInfo.setHandler(handler);
   downloadInfo.setState(handler.getState());
   db.saveOrUpdate(downloadInfo);
 }
 public void addNewDownload(
     String url,
     String fileName,
     String target,
     boolean autoResume,
     boolean autoRename,
     final RequestCallBack<File> callback)
     throws DbException {
   final DownloadInfo downloadInfo = new DownloadInfo();
   downloadInfo.setDownloadUrl(url);
   downloadInfo.setAutoResume(autoResume);
   downloadInfo.setFileName(fileName);
   downloadInfo.setFileSavePath(target);
   downloadInfo.setAutoRenameTmp(autoRename);
   HttpUtils http = new HttpUtils();
   http.configRequestThreadPoolSize(maxDownloadThread);
   HttpHandler<File> handler =
       http.download(
           url, target, autoResume, autoRename, new ManagerCallBack(downloadInfo, callback));
   downloadInfo.setHandler(handler);
   downloadInfo.setState(handler.getState());
   downloadInfoList.add(downloadInfo);
   db.saveBindingId(downloadInfo);
 }