I am trying to create an app where I send notifications at a specific time. I was looking at the JobScheduler API with the JobInfo.Builder but when I looked at this page:
https://developer.android.com/reference/android/app/job/JobInfo.Builder.html
I see that the setPeriodic method says:
Specify that this job should recur with the provided interval, not more than once per period. You have no control over when within this interval this job will be executed
So it seems like this method will randomly do the task within the set time.
How can I use the JobScheduler API to set a task to happen at an exact time?
How can I use the JobScheduler API to set a task to happen at an exact time?
You don't. JobScheduler
is specifically designed for inexact timing, so it can combine jobs from multiple apps, to try to reduce power consumption.
Your best option will be AlarmManager
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With