Git Product home page Git Product logo

Comments (2)

android10 avatar android10 commented on June 8, 2024

hey @balazsgerlei sorry for the late reply. After thinking a bit about it, I do not think there is a clean solution without breaking the core of this architecture.

This architecture exists for decoupling framework components in order to favor modularization and testing.

I would wait for someone else to reply but my take would be to just not use DownloadManager because from my perspective it is already coupling the framework by forcing the usage of a BroadcastReceiver.

You can have the same result by just using Retrofit for downloading a file, thus sticking to the architecture.

from android-cleanarchitecture-kotlin.

balazsgerlei avatar balazsgerlei commented on June 8, 2024

No problem and it's not an urgent question or anything, but I would be also very interested in other's take. As I mentioned I did implemented architectures inspired by this one and in some occasions I had to also integrate Android Framework features like DownloadManager - again this was only an example as I do remember needing it at one point, but there are certainly other similar APIs on Android.

As I also mentioned, what I did in that case was kind of "hacked it into" the architecture, basically circumventing the architecture by registering the BroadcastReceiver in the single Activity of the app and forwarding the result to the Fragment that is displayed. I didn't need too much logic anyway, as I just cancelled the indeterminate ProgressBar and displayed a SnackBar about the result (that the file is downloaded to a particular path). Even though I had Retrofit in that project and I'm well aware that the download could be implemented with that (and in fact it was at first), but the features that DownloadManager provides were ultimately more important (handling retries, connectivity issues, system restarts) - even though most of these (or maybe all) could have also been implemented with custom logic, it would certainly take much-much more effort and produce considerably more code that need to be maintained so I decided to use DownloadManager though I would have been much happier if I could have integrated it better in the architecture. And ever since (it was multiple years ago) I was wondering how it could have been done but I only thought about asking about it now.

from android-cleanarchitecture-kotlin.

Related Issues (20)

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.