本文介绍了如何使用 WorkManager 安排通知?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在用户每次在特定时间在数据库中添加注释时安排通知.虽然有多种方法可以使用 AlarmManager、BroadcastReceiver 等来完成,但如何使用 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?
推荐答案
WorkManager
不适用于需要在特定时间发生的工作.
WorkManager
isn't appropriate for work that needs to happen at a particular time.
您应该使用 AlarmManager
,特别是 AlarmManagerCompat.setExactAndAllowWhileIdle(),在特定时间获取回调.
You should use AlarmManager
, and specifically AlarmManagerCompat.setExactAndAllowWhileIdle(), to get a callback at a specific time.
这篇关于如何使用 WorkManager 安排通知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!