6155031
6155031

Reputation: 4327

PeriodicWorkRequest not repeating on the tick

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.

Upvotes: 5

Views: 499

Answers (1)

Rahul
Rahul

Reputation: 21104

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.

Upvotes: 6

Related Questions