Mes Mes - 9 months ago 70
Android Question

Start a Service using MVP pattern

I've been reading about

MVP
and I'd like to ask a few questions :

In my project I use lots of
IntentService
s to make some network calls. I am guessing that those services belong to
Model
layer of my app. But since they have a reference to context I'm not sure how I have to do it.
Should I just create another class
MyService
and in there start the
IntentService
? Maybe add all those services in a
ServiceModule
using
Dagger 2
?

I found a similar question here but there's no answer to it.

Answer Source

Just keep ApplicationContext in model classes, it's completely safe. You can read more about abilities of application context here https://possiblemobile.com/2013/06/context/
The two main advantages of MVP are testability and layer separation. If you can easily create unit tests for your presenters and models, you're doing right