Android 通知重复
我想为每天重复的事件设置通知。因此,通知应该每天在活动时间发出。如何在NotificationManager中设置任何通知,以便它在特定时间段后重复。
I want to set notification for an event which will repeat every day. So the notification should come everyday at event time. How to set any notification in NotificationManager so that it repeats after certain period of time.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您使用 AlarmManager 类,那么设置服务会更容易。
AlarmManager 类有一个 setRepeating 方法,可以在给定时间后以给定间隔重复闹钟调用。
就像..
在setRepeating参数中,你可以将YOURCALENDAR成员设置为你想要的时间......
If you are using AlarmManager class, it's more easier that to setup a service.
alarmManager class has a setRepeating method that repeats your alarm call at given interval after given time.
Like..
In the setRepeating argument, you can set the YOURCALENDAR member to the time you want......
你有点需要一个 Service
为此,如果我答对了你的问题
You kinda need a Service
for this, if I got your question right
为此,您创建了 2 个服务类来通知您的活动。
当任何事件发生时,只需调用事件的启动通知。如果您没有正确的想法,请对此发表评论。我会详细解释。
for this u have 2 made one service class that notify your event.
when any event occurs just call start notification on event. if u not get proper idea that comment on this ans. i'll explain in detail.