帮酷LOGO
0 0 评论
文章标签:thread  
Android Multi-Thread Download library

  • 源代码名称:MultiThreadDownload
  • 源代码网址:http://www.github.com/Aspsine/MultiThreadDownload
  • MultiThreadDownload源代码文档
  • MultiThreadDownload源代码下载
  • Git URL:
    git://www.github.com/Aspsine/MultiThreadDownload.git
  • Git Clone代码到本地:
    git clone http://www.github.com/Aspsine/MultiThreadDownload
  • Subversion代码到本地:
    $ svn co --depth empty http://www.github.com/Aspsine/MultiThreadDownload
    Checked out revision 1.
    $ cd repo
    $ svn up trunk
    
  • MultiThreadDownload

    Android多线程下载库。

    注释

    lib还没有完全测试并发布。 如果你发现一些 Bug,欢迎发布发布给我。

    演示

    下载

    演示屏幕截图

    Demo

    :如何使用

    • 步骤 1: 在'AndroidManifest.xml'中添加权限'
    <uses-permissionandroid:name="android.permission.INTERNET"/>
    <uses-permissionandroid:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    • 步骤 2: 在'生成。gradle'文件中添加"编译项目(': 库')。( Maven 或者jCenter支持即将出现)
    • 步骤 3: 在应用程序类中配置它
    privatevoid initDownloader() {
     DownloadConfiguration configuration =newDownloadConfiguration();
     configuration.setMaxThreadNum(10);
     configuration.setThreadNum(3);
     DownloadManager.getInstance().init(getApplicationContext(), configuration);
    }
    • 步骤 4: 只使用它 !
    // first: build a DownloadRequest:finalDownloadRequest request =newDownloadRequest.Builder()
    . setName(appInfo.getName() +".apk")
    . setUri(appInfo.getUrl())
    . setFolder(mDownloadDir)
    . build();// download:// the tag here, you can simply use download uri as your tag;DownloadManager.getInstance().download(request, tag, newCallBack() {
     @OverridepublicvoidonStarted() {
     }
     @OverridepublicvoidonConnecting() {
     }
     @OverridepublicvoidonConnected(longtotal, booleanisRangeSupport) {
     }
     @OverridepublicvoidonProgress(longfinished, longtotal, intprogress) {
     }
     @OverridepublicvoidonCompleted() {
     }
     @OverridepublicvoidonDownloadPaused() {
     }
     @OverridepublicvoidonDownloadCanceled() {
     }
     @OverridepublicvoidonFailed(DownloadExceptione) {
     }
    });//pauseDownloadManager.getInstance().pause(tag);//pause allDownloadManager.getInstance().pauseAll();//cancelDownloadManager.getInstance().cancel(tag);//cancel allDownloadManager.getInstance().cancelAll();//deleteDownloadManager.getInstance().delete(tag);

    如果你想提供代码,可以通过GitHub分叉存储库并发送一个请求请求来完成代码。

    谢谢

    联系我

    许可证

    
    Copyright 2015 Aspsine. All rights reserved.
    
    
    
    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.
    
    
    
    


    文章标签:thread  

    Copyright © 2011 HelpLib All rights reserved.    知识分享协议 京ICP备05059198号-3  |  如果智培  |  酷兔英语