Skip to content

esafirm/RxDownloader

Repository files navigation

RxDownloader

An Rx wrapper for Download Manager in Android

Usage

To download a file into your download directory (Environment.DOWNLOADS) use download()

String url = "https://upload.wikimedia.org/wikipedia/en/e/ed/Nyan_cat_250px_frame.PNG";
RxDownloader.getInstance(appContext)
            .download(url, "nyancat photo", "image/jpg") // url, filename, and mimeType
            .subscribe(path ->{
                // Do what you want with downloaded path
             }, throwable -> {
                // Handle download faile here
             });

To download file into the directory on the filesystem (Context.getFilesDir()) use downloadInFilesDir()

String url = "https://upload.wikimedia.org/wikipedia/en/e/ed/Nyan_cat_250px_frame.PNG";
RxDownloader.getInstance(appContext)
            .downloadInFilesDir(url, "nyancat photo", "image/jpg") // url, filename, and mimeType
            .subscribe(path ->{ /* file path */  }, throwable -> { /* handle error */ });

You can always use download(DowloadManager.Request request) for more customization and configuration.

You can also look at the sample for complete usage

Gradle

allprojects {
    repositories {
        ...
        maven { url "https://jitpack.io" }
    }
}
dependencies {
    compile 'com.github.esafirm:rxdownloader:2.0.0'
}

Thanks

  • Vladislav Nikolaev who migrate this library to RxJava2
  • Everyone who has contributed code and reported issues!

License

MIT @ Esa Firman

About

An Rx wrapper for Download Manager in Android

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy