Search code examples
javaandroidjobservice

Android send notifications at greatly increasing intervals


I am writing a reminder app for Android that repeatedly sends the user a notification with increasing intervals in between. Namely after 30s, 2m, 10m, ..., 25 days, 4 months, 2 years.

I originally intended to do this by registering a JobService that would run every 30s to check whether it was time to send a notification. However, as this post warns (and as I found out):

enter image description here

Which means that my job runs at most once every 15 minutes, and prevents me from sending my 30s, 2m and 10m reminders.

What would be the correct/most efficient way of implementing such functionality?
(Also, running a job every 30s to check for the 2y notification is quite inefficient)


Solution

  • Don't make it a periodic job. Make each next schedule a one-time event. Each time the job is triggered schedule a new item.