I'm building an Android App which have to periodically do something in a Service. And I found that using ScheduledThreadPoolExecutor
and ScheduledExecutorService
is preferable to Timer
.
Can anyone explain the difference between ScheduledExecutorService
and ScheduledThreadPoolExecutor
and which one is more suitable for Android?
Update
I just found this article and this post explain the difference between several way to implement repeating periodic tasks. In my case, ScheduledThreadPoolExecutor
and AlarmManager
is more suitable.