Reputation: 1335
im looking for a alternative to java.util.TimerTask.
My app should start random notifications over a month.
The TimerTask can only handle one, after that it doesnt work anymore.
Does it need to get called from a backgroundService? Or is something like AlarmManager enough?
Upvotes: 1
Views: 651
Reputation: 12919
You need to use AlarmManager
for scheduling tasks in this time range. There is an official training doc in the Android documentation that you might find interesting: https://developer.android.com/training/scheduling/alarms.html
Another possibility for scheduling tasks with longer periods is JobScheduler
, though that's more tailored for scheduling network jobs.
Upvotes: 2