在应用程序关闭时根据数据库中的数据安排通知

发布于 2025-02-11 17:34:09 字数 169 浏览 0 评论 0原文

我需要在确切的时间安排通知,但不要显示它,除非SQLITE数据库中存在某个值。

这可以通过另一种方式完成,通过每天00:00检查数据库,并根据数据安排通知。

因此,我需要控制OS是否应根据数据库显示通知还是不显示通知,或者我需要使用数据库并在关闭应用程序时安排通知。

有办法做到吗?

I need to schedule a notification at an exact time, but not to show it except if a certain value exists in the SQLite database.

This can be done in another way, by checking the database daily at 00:00, and scheduling the notification depending on the data.

So, I need to control if the OS should show a notification or not depending on the database, or I need to use the database and schedule the notification when the app is closed.

Is there a way to do that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

与之呼应 2025-02-18 17:34:09

您可以通过检查数据库中的标志来设置通知。例如:如果
数据库架构:

CREATE TABLE notification(id INTEGER PRIMARY KEY AUTOINCREMENT,name TEXT,description TEXT, time TEXT, showNotification TEXT)

将数据库映射到模型:

Reminder(
          id: map['id'],
          name: map['name'],
          description: map['description'],
          time: map['time'],
          showNotification: map['true'] ? true: false,
);

如果显示示例化标志为真,请设置通知或不设置通知

You can set the notification by checking the flag in the database. For example: if the
Database schema:

CREATE TABLE notification(id INTEGER PRIMARY KEY AUTOINCREMENT,name TEXT,description TEXT, time TEXT, showNotification TEXT)

Map database to a model:

Reminder(
          id: map['id'],
          name: map['name'],
          description: map['description'],
          time: map['time'],
          showNotification: map['true'] ? true: false,
);

If showNotification flag is true, set the notification or else, do not set notification

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文