Take the 2-minute tour ×

I'm developing a app that requires sync with the server app every 5 minutes... Which is the best way to accomplish that? I'm using a ThreadPoolExecutor (java way...) but I'm not very happy with that... and I want to know what other solutions can you provide me....


share|improve this question

3 Answers 3

up vote 3 down vote accepted

Either you can use Thread, AsyncTask with time interval of 5 minutes, or just use a background service which execute web-service at every 5 minutes continuously.

Also Use AlarmManager to set up your schedule and an IntentService to do the actual work. The IntentService automatically gives you your background thread for your network I/O, and it automatically shuts down the service when the work is complete.

share|improve this answer

Try using AlarmManager to wake up your app (service or whatever) every 5 minutes to perform the operation.

Some examples:

  1. It wakes CPU every 10 minutes until the phone turns off: Alarm Manager Example

  2. Using AlarmManager to Schedule Activities on Android: http://justcallmebrian.com/?p=129

share|improve this answer

I favour alarm manager / broadcast receiver solution with non-wakeup alarms. Updating information from webservice seldom makes sense for slleping phones ( as there is no user present to react or notice changes ) - thus you can save traffic and power

share|improve this answer

Your Answer


