I would like to perform a REST API request every X mins to update the database my application uses.
That should happen whether my application is running or not. That also means, if the user restarts their mobile, the polling should start straightaway, without the need to run the application first.
Basically I want to implement kind of this Unix cronjob
*/5 * * * * /usr/local/bin/update_something.sh
Is that possible via the Android Services? If so, can you please give me some basic directions?
Thanks.
Yes you can use a service but a service needs to be triggered/started at some relevant point of time. You can try using classes like
AlarmManagerthat can trigger your service every x mins.http://developer.android.com/reference/android/app/AlarmManager.html
Edit-
To start your service at device boot you can use a broadcast receiver
Chk this link out
http://www.androidcompetencycenter.com/2009/06/start-service-at-boot/