Im setting PeriodicWorkRequest for 15 minutes. But its repeating sometimes 10 sometimes 17 minutes. How can I set max a few seconds deviation.
val workRequest = PeriodicWorkRequest.Builder(NotificationWork::class.java, 15, TimeUnit.MINUTES).build()
WorkManager.getInstance().enqueue(workRequest)
13:10
13:26
13:51
14:01
Can I set a background work like an alarm on the tick or else Workmanager work like this always?
My code block is like above.
As Marko said, Precise scheduling is battery in-efficient. WorkManager APIs don't guarentee schedule for that very reason. If you want strict timing, you can take a look at the AlarmManager APIs for that.
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