如何在 Android 中创建自定义调度程序?
我有一个名为 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
理论上,您需要制定待处理意图并将时间设置为表中任何预定义时间的下一个时间。现在编写广播接收器,在 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.