After watching the very known video on this topic I decided to go with design pattern B. Using a contentprovider with servicehelper.
Basically I have the following files:
- MyProvider
- MyDatabase
- Mycontract
In the activity I can now get the contentresolver and query the provider. All is working great so far.
Now I need to sync my contentprovider to fetch data from my REST API. Thus I need to implement a service helper service and Rest method. Studying the Google IO app has helped me a lot, I'm a novice with Android so it's still hard to figure it out.
I see Google uses RemoteHandlers to process the external data, I guess they are the Processor classes in the diagram?
What I don't understand is how I can implement the servicehelper + service part to get the data from the network.
- Where do I call on the service helper?
- What do the service and helper need to do exactly?
- Are there any good examples of this exact design pattern?
I have read several topics on stack about this, all suggesting different methods. I found an example which declares a restprovider and then myProvider has to extend that provider. I don't like those solutions and want to follow this structured design pattern.