Skip to content Skip to sidebar Skip to footer

Contentprovider Or Service?

I am writing an application that shows 'Japanese Traditional Time' (JTT for short). There are several components (notification, widgets, application itself, alarms) which all use t

Solution 1:

Content providers are for structured data, so it doesn't really fit your use case. Not sure what you mean by 'asynchronous responses'? Calling a remote service is usually just like a local function call, it will block and return a value when done. If you have to notify multiple components a broadcast is the way to go. Explore using a LocalBroadcast if all components are in the same process (check Android support library source), or set a permission on it to make sure other apps cannot get it if you need to send a system-wide (regular) one.

Solution 2:

I'm sticking with "just service" - I have discovered Sticky Broadcasts which actually cover the problem I had with common Broadcasts (having to request latest data from service after registering but before getting the first "tick") and that leaves me with much less cases where I need actual service connection.

Post a Comment for "Contentprovider Or Service?"