如何在 Android 中创建自定义调度程序?

发布于 2024-12-13 14:27:51 字数 196 浏览 2 评论 0原文

我有一个名为 events 的表,其结构如下:

id
name
date
time

我想要的是,在表中提到的日期和时间,屏幕上应该弹出通知。

我想了解应用程序成功安装后,进程是否应始终在后台运行以检查当前时间是否已达到事件表中提到的时间,还是有其他方法可以完成此操作?

I have a table named events whose structure is as follows:

id
name
date
time

What i want is that at the date and time mentioned in the table a notification should popup on the screen.

I want to understand whether after the application has been installed succeessfully, the procees should always run in the background to check whether the current time has reached the time mentioned in the events table or there is another way to accomplish this?

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

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

发布评论

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

评论(1

丘比特射中我 2024-12-20 14:27:51

理论上,您需要制定待处理意图并将时间设置为表中任何预定义时间的下一个时间。现在编写广播接收器,在 onRecieve() 方法中,除了执行其他任务之外,您还需要下次从表中查找并设置下一个待处理意图。

Theoretically you need to make a pending intent and set the time as next whatever predefined time from your table. Now write the Broadcast receiver and in the onRecieve() method apart from doing your other tasks you need the find the next time from your table and set the next pending-intent.

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