1

I've been reading about MVP and I'd like to ask a few questions :

In my project I use lots of IntentServices 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.

Community
  • 1
  • 1
Mes
  • 1,671
  • 3
  • 20
  • 36

1 Answers1

1

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

Buckstabue
  • 283
  • 1
  • 13