Search code examples
androidbackground-task

Schedule a service - android java tips for the implementation


I want to implement a service that start, update some data and then end all in the background, the user don't have to see anything.

The service should start at certain time or condition even if my app is closed.

I saw that there is more method for do this... Pending Intent + Alarm Manager or ScheduledThread but i don't know the best way or the more efficient way.

What i should use? How can i implement that?

By the way the service can last even some minutes and need the internet connection.


Solution

  • Use IntentService with AlarmManager. https://developer.android.com/training/scheduling/alarms.html