I am writing an application in which user can configure alerts/alarms. At this point, I have everything working expect the one. I am firing off an alarm using
Intent alarmIntent = new Intent(AlarmClock.ACTION_SET_ALARM);
alarmIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
alarmIntent.putExtra(AlarmClock.EXTRA_MESSAGE, "Some message!");
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.MINUTE, 1);
alarmIntent.putExtra(AlarmClock.EXTRA_HOUR, calendar.get(Calendar.HOUR_OF_DAY));
alarmIntent.putExtra(AlarmClock.EXTRA_MINUTES, calendar.get(Calendar.MINUTE));
alarmIntent.putExtra(AlarmClock.EXTRA_SKIP_UI, true);
context.startActivity(alarmIntent);
I want to remove this alarm once user has dismissed using the Dismiss button. I can see the alarms being still there in the alarm clock which I set using above code through my application.
Is there some way to get a cursor or something similar on the alarms being there in the alarm clock? This will help me iterate over them and remove the ones I want.
Any help would be appreciated, Thanks in advance.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…