Search code examples
androidandroid-jetpackandroid-workmanager

How to schedule notifications using WorkManager?


I want to schedule a notification everytime the user add a note in the database for a specific time. While there are multiple ways to do it using AlarmManager, BroadcastReceiver etc. How can it be done using WorkManager?


Solution

  • WorkManager isn't appropriate for work that needs to happen at a particular time.

    You should use AlarmManager, and specifically AlarmManagerCompat.setExactAndAllowWhileIdle(), to get a callback at a specific time.