rkmax
rkmax

Reputation: 18133

How to structure an application properly on background processes

I have an application that uses a webservice to get information and save the changes made ​​by the user.

currently I have one service that runs while the application is open, and it has public methods for each operation. the trouble is that service is growing considerably and I'm thinking refactor, but the question is what is the best way?

I can think of the following options:

  1. Deferred services the current service and that all are initialized at boot time application
  2. Create small services and that these are initialized by local broadcast

although I have doubts about performance. Can give me some clue or example about which method is better, do not really care that changes are instantly synchronized, these are stored locally and can be synchronized when possible. Data sent are not many, so the synchronization is relatively fast

Synchronization processes are something like

Upvotes: 0

Views: 46

Answers (1)

Marcin Orlowski
Marcin Orlowski

Reputation: 75629

Most likely there's no point of having Service running all the time. Instead, I'd go for IntentService. If possible, I'd also condifer using push notification (like GCM) so the server could let my app know that there's new data to fetch (or maybe even send it to me if you'd fit in the GCM payload limit).

Upvotes: 1

Related Questions