Giter Club home page Giter Club logo

androidfiledownloader's Introduction

AndroidFileDownloader

##使用场景 ###apk应用内更新,其他中小文件的下载,断点续传下载等,先来看看效果图:

开始

项目使用 jitpack 做开源库的托管,你需要在 .gradle 中添加 jitpack 的仓库。

allprojects {
    repositories {
        jcenter()
        maven { url "https://jitpack.io" }
    }
}

在添加 FloatUtil 的依赖引用:

dependencies {
     compile 'com.github.liuguangli:downloaderlibrary:master-SNAPSHOT'
}

##简单方便的调用接口 ###调用者只要设置好下载路径、文件后缀,丢一个url即可开始下载,并且可以根据需要监听进度,例如:


        FileDownloader mDownloader  = FileDownloader.getInstance(getApplication());
        mDownloader.setExtend(".apk");
        mDownloader.setFilePath(Environment.getExternalStorageDirectory() + "/apk/");
        mDownloader.addFile("http://zhuzher.vanke.com/uip/zhuzher.apk");
        mDownloader.setDownloadObserver(new DownloadObserver() {
            @Override
            public void onUpdate(String apkUrl, String file, int completeSize, int apkFileSize) {
             //do your thing
            }
            @Override
            public void onComplete(String file) {
             //do your thing
            }

            @Override
            public void onError(String apkUrl, int type, int state) {
                //do your thing
            }
        });

androidfiledownloader's People

Contributors

liuguangli avatar

Watchers

James Cloos avatar Andy avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.