如何检查 AlarmManager setRepeating 触发的 Pending 意图是否已经在运行?
我很高兴知道如何检查是否由警报管理器触发的待处理意图,该警报管理器在 AlarmManager.setRepeating 给出的特定时间启动活动?
更具体地说,我有一项活动以特定的设定时间或重复时间(有效)启动另一项活动。但我想知道用户是否已经设置了该请求?在这种情况下,我不应该开始某些值。
这就是我开始预定活动的方式。
Intent myIntent = new Intent(getBaseContext(),MyScheduledReceiver.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(getBaseContext(), 0, myIntent, 0);
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), interval, pendingIntent);
I would be glad to know how to check if Pending intent which is triggered by an Alarm Manager which starts an activity at a specific time given by AlarmManager.setRepeating?
To be more specific, I have an activity which kicks off another activity with a paticular set time, or repeating time, (which works) . But i want to know if the request was already set by the user? in that case i should not start certain values.
This is how i start the scheduled activity.
Intent myIntent = new Intent(getBaseContext(),MyScheduledReceiver.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(getBaseContext(), 0, myIntent, 0);
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), interval, pendingIntent);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,我想我已经找到了方法,
谢谢,希望它对某人有帮助......
Ok, I think i have managed to find out how,
Thanks, hope it might be helpful for someone...