如何检查是否待定意图通过AlarmManager setRepeating触发已经运行? [英] How to check if Pending intent triggered by AlarmManager setRepeating is already running?
问题描述
我会很高兴知道如何检查挂起的意图是通过报警管理器,它开始的活动在由AlarmManager.setRepeating给出一个具体的时间触发?
更具体,我有一个活动揭开序幕另一个活动与paticular设定的时间,或重复一次,(其中工程)。但我想知道,如果该请求已经由用户设置?在这种情况下,我不应该启动某些值。
这是我如何开始计划活动。
意图myIntent =新的意向书(getBaseContext(),MyScheduledReceiver.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(getBaseContext(),0,myIntent,0);
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP,calendar.getTimeInMillis(),间隔,pendingIntent);
确定,我想我已经设法找出如何,
//检查是否正在等待的意图是已经运行
意图checkIntent =新的意图(getApplicationContext(),MyScheduledReceiver.class);
alarmUp =(PendingIntent.getBroadcast(getBaseContext(),0,checkIntent,PendingIntent.FLAG_NO_CREATE)!= NULL);
感谢,希望它可能会有所帮助的人......
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);
Ok, I think i have managed to find out how,
//CHECKING IF PENDING INTENT IS ALREADY RUNNING
Intent checkIntent = new Intent(getApplicationContext(),MyScheduledReceiver.class);
alarmUp = (PendingIntent.getBroadcast(getBaseContext(), 0, checkIntent, PendingIntent.FLAG_NO_CREATE) != null);
Thanks, hope it might be helpful for someone...
这篇关于如何检查是否待定意图通过AlarmManager setRepeating触发已经运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!