Comments (2)
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.
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)
- Suspending version of the fold operator?
- RUN migration-to-hilt Crash ? HOT 1
- Q1
- Questions: How to combine multiple UseCase? HOT 4
- Question: Why use Either instead of just throwing exceptions? HOT 1
- MovieDetailsViewModelTest always passed HOT 1
- GlobalScope in UseCase layer is antipattern? HOT 2
- How to auto cancel UseCase job when the ViewModel is destroyed HOT 4
- Question : How to tidy up the different data models in each feature.
- Hot observable with asyc.
- onResult() performance!
- Support for Kotlin Multiplatform
- Data organization
- UseCase Without return Value HOT 2
- Other options for entity mapping? HOT 1
- Best place for input validation? HOT 4
- How to handle REST and GraphQL? HOT 1
- How to put few call api to usecase ? HOT 10
- How to merge multiples repositories response in the use case HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from android-cleanarchitecture-kotlin.