別の時間にアラームを設定しています。特定のアラームを削除したい。元。異なる時間に 100 個のアラームを設定しましたが、2012 年 2 月 25 日の午前 10 時 45 分に設定されたアラームを削除したいと考えています。どうやってやるの。
アラームを設定するために次のコードを書きました。
final AlarmManager am = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
GregorianCalendar gc=new GregorianCalendar();
gc.set(2012, 1, 22, 10, 42,0);
Intent intent = new Intent(this, AlarmService.class);
gc.set(Calendar.AM_PM,0);
final PendingIntent sender = PendingIntent.getBroadcast(this, 1, intent, PendingIntent.FLAG_UPDATE_CURRENT);
am.set(AlarmManager.RTC_WAKEUP, gc.getTimeInMillis(), sender);
アラームを受信するブロードキャスト レシーバーがあります。