Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat is the best approach for Android Service and data communication
    primarykey
    data
    text
    <p>I am looking for the best approach to share data between a service and 2 different clients (an app and a widget). Currently my application kicks off a thread that downloads a large amount of data every 15 seconds or so in the background, stuffs them into an object graph, which is then consumed by the main app on a configurable time interval. This works for the primary app but isn't sufficient for the widget that I want to develop as well, because the object graph will be out of process (and the approach is kind of messy IMO).</p> <p>So I am looking to extract the data retrieval part into a service (or if there is a better suggestion, something else). My question is, what is the best way to communicate the data received from this service with the clients? Or would you not use a service and instead use something else?</p> <p>Because of the overhead on the client, I want the service to notify the clients when data is ready as opposed to the client continuously polling the service.....if possible...of course.</p> <p>I have looked at broadcasting the intent (both app and widget would receive) but I think I have to serialize the entire object graph and then inflate it in the client in order to do that. Is that correct? I am concerned with the speed at which I can accomplish the re-inflate client side.</p> <p>Is there a better way to ship the data back to the clients? I would prefer to ship the objects if that is possible and not serialize...but if that is the best way, then I will do it.</p> <p>Any help is greatly appreciated!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload