I have a two part question. Both are somewhat general.
- I'm creating an app that relies heavily on communication with a server. I plan to have different classes for each repository I'll need. Is an Android service the correct pattern to use here? There may be certain situations where I'll want to cache things between activities. Will a service allow me to do this?
- Assuming a service is what I want to use for this, how can I load content once the service is bound. When the user opens the app, I want to start loading content. However, binding a service isn't blocking, so I can't write the code that makes requests with the service in my
onStart()
right? Is there some helper class that will wait for the service to load then execute a function? I know I could put some code in myonServiceConnected()
method but I'd like to stay away from coupling like that.
Hopefully that wasn't too abstract. Thanks in advance.