Workmanager vs Alarm manager

Merry Christmas and wish you a happy new year.
I have a case where the user pick a time from the time picker
And at that time(the time that the user selected) i have to notify the user by sending a notification
My question is
Should i use workmanager and enqueue the work
By setting an initial delay that is equal to the time picked minus the current time (aka the difference)
Or should i set an alarm that will be triggered at the time picked?

If both methods give me the same result
What are the advantages of using one over the other?
Thank you

I would do everything in my power to avoid the need for that functionality. Otherwise:

  • If your app is an alarm clock, or could reasonably be considered an alarm clock, use setAlarmClock() on AlarmManager

  • Otherwise, if your app has a server, consider sending a Firebase Cloud Messaging (FCM) message from the server at the designated time (or a few seconds early) and notifying the user upon receipt of the message

  • Otherwise, use AlarmManagerCompat.setExactAndAllowWhileIdle(), bearing in mind that despite the method name it could be off by a fair bit for devices in Doze mode at the time