It sounds like you have the right idea.

A ContentProvider is a wrapper around your database which allows other
applications to access and modify your database in a controlled
manner.
A Service is basically just a long-running task, such as downloading/
syncing data.

A ContentProvider would provide access to your data to your app and
others, and you would use a Service to download the new data, which
would then use your ContentProvider to insert that new data into your
database.

On Aug 19, 4:49 pm, Lily Zhang <lily...@gmail.com> wrote:
> I am developing an app and get confused about the idea of Service and
> Content Provider in Android. In practice, what will be the difference
> between them?
>
> Content Provider
> is a facade and it defines a way to share data among applications. You
> many attach a local database to your app or create Content Provider
> mapped to a universal database so that all the application on the same
> device can share it.
>
> Service
> is long running processes that need to be decoupled from main
> activity. It has local and remote service. local service is like the
> local database, and remote service is like Content Provider sharing
> the database info.
>
> What My App is doing?
> downloads info. from multiple internet resource in the background (I
> suppose this will be Service) and store the info. into database, and
> multiple applications will need to retrieve the data, format them and
> output them to user (I guess it will be a Content Provider).
>
> What will be the fine line between Service and Content Provider?
> Newbie in Android, and any suggestion is welcome.
>
> Lily

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to