I have packaged my app module into data, domain and presentation layer and following the MVVM design pattern. I want to expose my database via content provider to another app. Where should I place the content provider in this architecture?
I have packaged my app module into data, domain and presentation layer and following the MVVM design pattern. I want to expose my database via content provider to another app. Where should I place the content provider in this architecture?
It'll be in the data layer. We can create a data source class for communicating with content provider. You can find a sample implementation in this link, which shows fetching contacts from content provider.
Saurav Ghimire. Now I'm considering a similar problem just like you.
I think the ContentProvider should be placed in the Data layer because the ContentProvider provides some data to the app(presentation layer).
If we place the ContentProvider in the Data layer(data module), we don't have to pay attention to the data transfer logic when we manage our application.
Also, we can reuse the data layer in the future because the data layer doesn't have any "presentation logic" in their code.