A
A
Alina Mitrokhina2019-11-12 20:33:10
Android
Alina Mitrokhina, 2019-11-12 20:33:10

Why is Jetpack WorkManager not working at the right time?

I'm trying to trigger timed notifications using WorkManager from Jetpack. Accordingly, I have a Worker class in my application. It accepts the notification title and text as input parameters. The doWork() method describes the logic for displaying a notification. For the health test, I created a OneTimeWorkRequest in MainActivity and queued it for execution. But I can not understand why it is not executed at the right time. I created a date using Calendar, took the timestamp from the date, setInitialDelay specified TimeUnit MILLISECONDS. But nothing works. I will attach the MainActivity and Worker code below
https://pastebin.com/MaW7fdsd - Worker
https://pastebin.com/vEt8ikjc - MainActivity
Any help would be greatly appreciated.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question