The difference between an Android service and a content provider

I am developing an application and am confused with the idea of ​​a service and content provider in Android. In practice, what's the difference between the two?

Content Provider
is a facade, and it defines how data is exchanged between applications. You attach a local database to your application a lot or create a content provider mapped to a universal database so that all applications on the same device can share it.

Service
these are lengthy processes that need to be separated from the core business. It has local and remote service. the local service is like a local database, and the remote service is like a content provider sharing database information.

What My App is doing?
uploads information. from several Internet resources in the background (I suppose it will be a Service) and save the information. to the database, and several applications will need to retrieve the data, format it, and output it to the user (I assume it will be a content provider).

What will be the fine line between the service provider and the content? New to Android, and any suggestion is welcome.

Lily

+5
source share
1 answer

Your understanding of the difference between Serviceand ContentProvideris fairly accurate. The main thing is that it ContentProvidersimply acts as a channel for extracting data, but is Servicedesigned to do something in the background without interacting with the user.

+5

All Articles