Skip to content

Initialization

Jacksgong edited this page May 25, 2017 · 43 revisions

I. Install

FileDownloader is installed by adding the following dependency to your build.gradle file:

dependencies {
    compile 'com.liulishuo.filedownloader:library:1.4.2'
}

II. Initialization

To begin using FileDownloader, have yourApplication#onCreate invoke the FileDownloader.init(this) such as:

If your want to customize OkHttpClient for downloading files, @see DemoApplication

public XXApplication extends Application{

    ...
    @Override
    public void onCreate() {
        super.onCreate();
        /**
         * Just for cache Application's Context, and ':filedownloader' progress will NOT be launched
         * by below code, so please do not worry about performance.
         */
        FileDownloader.init(getApplicationContext());
    }

    ...
}