安卓闹钟提醒
我有一个应用程序正在从 SQLite
数据库加载即将到来的日期(例如生日) 并将其显示在 ListView
上。效果很好。 我现在想要的是通过 Alarm
或 Toast
或没有的东西定期通知用户 启动应用程序。用户只有一个选择何时通知:同一天或1天前以及时间! 有人知道如何实现这一点吗?也许是 Service
或 Timer
,或者两者兼而有之? 我会很高兴得到一些提示。
I have an app which is loading upcoming dates (like Birthdays) from an SQLite
database
and showing it on a ListView
. That works fine.
What I now want is to inform the user regular by an Alarm
or Toast
or something without
starting the application. The user has the only option when to inform: on the same day or 1 day before and the time!
Has someone an idea how to realize this? Maybe a Service
or a Timer
, or both?
I would be very pleased about some tips.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看 AlarmManager。另请注意,该服务不会在会话之间保留警报,因此您需要 设备启动后重新设置它们。另一种选择可能是使用 Google 日历 API 创建生日活动,然后通知将由 Google 日历应用程序处理。
Take a look onto AlarmManager. Also note that the service doesn't persist alarms between sessions so you'll need to re-setup them after device boot. Another option may be using Google calendar API to create birthday events, notification will be handled by Google calendar app then.